PTLib  Version 2.10.4
PSyncPointAck Class Reference

This class defines a thread synchronisation object. More...

#include <syncthrd.h>

Inheritance diagram for PSyncPointAck:
PSyncPoint PSemaphore PSync PObject

List of all members.

Public Member Functions

virtual void Signal ()
 If there are waiting (blocked) threads then unblock the first one that was blocked.
void Signal (const PTimeInterval &waitTime)
void Acknowledge ()
 This indicates that the thread that was blocked in a Wait() on this synchronisation object has completed the operation the signal was intended to initiate.

Protected Attributes

PSyncPoint ack

Detailed Description

This class defines a thread synchronisation object.

This may be used to send signals to a thread and await an acknowldegement that the signal was processed. This can be be used to initiate an action in another thread and wait for the action to be completed.


    ... thread one
    while (condition) {
      sync.Wait();
      do_something();
      sync.Acknowledge();
    }
    ... thread 2
    do_something_else();
    sync.Signal();    // At this point thread 1 wake up and does something.
    do_yet_more();    // However, this does not get done until Acknowledge()
is called in the other thread.

Member Function Documentation

This indicates that the thread that was blocked in a Wait() on this synchronisation object has completed the operation the signal was intended to initiate.

This unblocks the thread that had called the Signal() function to initiate the action.

virtual void PSyncPointAck::Signal ( ) [virtual]

If there are waiting (blocked) threads then unblock the first one that was blocked.

If no waiting threads and the count is less than the maximum then increment the semaphore.

Unlike the PSyncPoint::Signal() this function will block until the target thread that was blocked by the Wait() function has resumed execution and called the Acknowledge() function.

The waitTime parameter is used as a maximum amount of time to wait for the achnowledgement to be returned from the other thread.

Reimplemented from PSemaphore.

void PSyncPointAck::Signal ( const PTimeInterval waitTime)

Member Data Documentation


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines