Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Examples

examp13.cpp

This example is to show use of the SemaphoreGroup and Semaphore.

For this test we use the MutexSemaphoreGroup and related type to emulate a double exchange example:

Thread 1 (main) : Performs the housekeeping and data source Thread 2 (child) : Is the data sink

Both threads have a control semaphore which the other thread uses to control access to a resource , in this case the the data counter gvalue. They are also used as a synchronization mechanism,

A third semaphore is used as a flag/signal to indicate that the threads should drop out of the source->sink loop.


This is the CoreLinux++ reference manual
Provided by The CoreLinux Consortium