Four Code Snippets for Multi-threading in a Win32 Environment


Synchronization is essential in programming for multi-threaded applications because concurrent access to shared data may result in data inconsistency since threads normally run asynchronously. Access to these data needs to be synchronized. Multithreaded programming involves writing software to synchronize resource access between threads by using multiple threads in a useful and efficient manner. It is the responsibility of the programmer to use synchronization objects to ensure correct order of execution of threads. There are various synchronization mechanisms in the Microsoft Win32 API that help in using threads in an efficient manner. These are Critical Sections, Mutexes, Semaphores and Events, which are demonstrated in the code snippets available for download below.

Target Audience

Web developers, developers building application server code, developers working with multiple processor systems. Basically any developers working in a 32-bit Windows environment where optimization of code would be of interest via multi-threaded programming would find these snippets worth a look.

Sample Category


Implementation Language


Target Hardware & Software Platforms

Hardware Systems: Systems running Intel® Xeon® processors

Operating Systems: Microsoft Windows* 2000 and other Win32 operating systems

Compilers: nonspecific

Download Code Sample

About the author

Soumya Guptha is a Technical Marketing Engineer in the Software Solutions Group at Intel Corporation.

Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.