Understanding Threads
Every application or service has at least one thread. Although the service will usually have much more than just one thread, it has to have at least one thread to perform any work. When an application (or in this case, a service) starts, its primary thread is fired up and begins processing messages from the system. These messages can be mouse clicks, keyboard input, custom events, operating system alerts, and more.
The service we are working with in this book has a primary thread called by the Service Control Manager (SCM). Remember that the SCM states that your service is running only if your <OnStart> method returns within 30 seconds of the start request. Imagine, however, if you only used the primary thread to do work. ...
Get Programming Windows® Services with Microsoft® Visual Basic® 2008 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.