Threads

Native Processes and Threads is a deep subject that’s well-documented on the Microsoft site. Knock yourself out. The workhorse functions are below in the references.

Win32 provides several atomic functions through the Interlocked API, the highlights of which are InterlockedIncrement and InterlockedDecrement.

There are several Synchronization Objects - ’events’, mutexes, critical sections, semaphores, and waitable timers. Of these, events seem to crop up the most often. A critical section is like a mutex but scoped to a single process.

Use a counting semaphore to implement throttling, one use case would be to limit the number of concurrent network requests. The other synchronization objects all have a capacity of one.

Win32 also has Fibers. This is a niche API for specific use cases.


References