O'Reilly logo

Programming Windows® Services with Microsoft® Visual Basic® 2008 by Michael Gernaey

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Extending <OnPause> and <OnContinue>

Remember that we created a way to indirectly control the flow of service. Using <OnPause> and <OnContinue>, we can write code that will allow us to either block threads from doing work or make them intuitive enough to know whether they should exit or merely delay their processing responsibilities.

Ways to Control Thread Processing

We will implement a couple of different ways to control what the threads do.

Thread Suspension

Our first attempt at thread control will be to use the built-in Thread class method called Suspend. This method will allow us to stop a thread in its tracks, or at least attempt to. A thread suspension can fail, in which case we would end up in a situation that we must code for—a rogue thread. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required