Chapter 7. Synchronization

The previous chapter discussed threads and processes. Threads in particular tend to be extremely useful because they give your applications the ability to do many things at once. After a little practice, you start to think of a thread function as nothing more than a normal function that returns immediately and executes in the background.

However, there is one minor problem with thread functions. Because you can have several threads running at the same time, it is possible for them to compete with each other, or for them to run into each other, in ways that are often quite unexpected. A single-threaded application is something like a car driving around in a completely empty parking lot. Because the lot is empty, the ...

Get Win32 System Services: The Heart of Windows® 98 and Windows® 2000 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.