background preloader

Windows

Facebook Twitter

Winsock Functions. Process Monitor. Windows Sysinternals: Documentation, downloads and additional resources. Introduction to Multi-threaded Code. Download no synchronisation example - 31 KbDownload critical section example - 9 KbDownload mutex example - 9 KbDownload event object example - 9 Kb Someone recently asked me what I recommend for synchronizing worker threads and I suggested setting an event.

Introduction to Multi-threaded Code

This person's response was that you could not do that since worker threads do not support a message pump (UI threads are required to support messages). The confusion here is that events and messages are different animals under windows. I have forgotten where I originally copied these examples, but I found them to be interesting because of their simplicity. If anyone is aware of the author of this code, I would appreciate hearing from you, so I can give him/her credit. Writing a Multithreaded Win32 Program. Each thread has its own stack and its own copy of the CPU registers.

Writing a Multithreaded Win32 Program

Other resources, such as files, static data, and heap memory, are shared by all threads in the process. Threads using these common resources must be synchronized. Win32 provides several ways to synchronize resources, including semaphores, critical sections, events, and mutexes. When multiple threads are accessing static data, your program must provide for possible resource conflicts.