Abstract
Mutexes prevent different threads from stepping on each other’s toes while events allow them to dance in harmony with one another — mutexes and events together encompass all the thread synchronization facilities necessary for multi-threaded programming. Indeed the next chapter shows how mutexes and events can be combined to create semaphores, another essential building block for thread synchronization. An event provides an efficient mechanism for coordinating the activities of cooperating threads — one thread signals that an event has occurred and another thread waits quietly for the signal without wasting valuable processor power in polling. This two-handed communication between threads allows the order in which the various threads execute their code to be precisely regulated by the program — mutex protection, on the other hand, does not make any promises regarding the thread serialization sequence. The key topics covered by this chapter include:
-
automatic and manual events
-
the EVENT class
-
the ‘producer-consumer’ paradigm
-
implementation details for UNIX and Windows
Preview
Unable to display preview. Download preview PDF.
Copyright information
© Springer-Verlag London Limited 2000