PSyncPoint Class Reference

#include <syncpoint.h>

Inheritance diagram for PSyncPoint:

PSemaphore PSync PObject PSyncPointAck List of all members.

Public Member Functions

 PSyncPoint ()
 PSyncPoint (const PSyncPoint &)

Detailed Description

This class defines a thread synchronisation object. This form of semaphore is used to indicate an event has occurred. A thread may block on the sync point and wait until another thread signals that it may continue. eg:
    ... thread one
    while (condition) {
      sync.Wait();
      do_something();
    }

    ... thread 2
    do_something_else();
    sync.Signal();    // At this point thread 1 wake up and does something.
    do_yet_more();

Note that events are boolean in nature. If "thread one" is not waiting on the event, multiple calls to Signal() are ignored, thread one will only exit the Wait() call a single time once it gets there. Similarly, if multiple threads are waiting on the event, only one thread will be released. As you cannot know which thread will be released this mode of use is not recommended.


Constructor & Destructor Documentation

PSyncPoint::PSyncPoint (  ) 

Create a new sync point.

PSyncPoint::PSyncPoint ( const PSyncPoint  ) 


The documentation for this class was generated from the following file:
Generated on Thu May 27 01:36:49 2010 for PTLib by  doxygen 1.4.7