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. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access