Portable signal class. More...
#include <Inventor/threads/SbThreadSignal.h>
Public Member Functions | |
SbThreadSignal (SbThreadMutex *mtx) | |
Constructor. | |
~SbThreadSignal () | |
Destructor. | |
void | signalOne () |
Signals one thread that is waiting on this object. | |
void | signalAll () |
Signals all threads that are waiting on this object. | |
void | wait () |
Waits for a signal notification. | |
SbBool | trywait (const unsigned int timeout_ms) |
Waits for a signal notification or timeout milliseconds have elapsed. | |
This class provides a portable "condition variable" object. Condition variables are used when one thread wants to wait until another thread has finished doing something: the first thread "waits" on the condition variable, the second thread "signals" the condition variable when it is done. It is implemented using the pthreads API on UNIX/Linux and the Win32 API on Microsoft Windows.
It is not necessary to use this class in order to use multiple threads with Open Inventor. It is provided only as a convenience. However, note that you should use pthreads on UNIX/Linux and Win32 on Windows to be certain of compatibility with Open Inventor.
SbThreadAutoLock, SbThreadBarrier, SbThreadMutex, SbThreadRWMutex
Definition at line 64 of file SbThreadSignal.h.
SbThreadSignal::SbThreadSignal | ( | SbThreadMutex * | mtx | ) |
Constructor.
SbThreadSignal::~SbThreadSignal | ( | ) |
Destructor.
void SbThreadSignal::signalAll | ( | ) |
Signals all threads that are waiting on this object.
void SbThreadSignal::signalOne | ( | ) |
Signals one thread that is waiting on this object.
SbBool SbThreadSignal::trywait | ( | const unsigned int | timeout_ms | ) |
Waits for a signal notification or timeout milliseconds have elapsed.
If the timeout elapses before the signal is notified, the function returns FALSE to the caller, signifying that a timeout has occurred.
void SbThreadSignal::wait | ( | ) |
Waits for a signal notification.
When called, it goes to sleep awaiting a subsequent notification from another thread (via the signalOne or signalAll methods).