Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

int phConditionCounter::wakeup  ) 
 

The wakeup method allows waiting threads to be woken up if they are blocked on the condition variable. A specific return code will be returned from this method so that a thread can handle the wakeup procedure when it occurs.

The wakeup method works because only one thread is allowed access to the current instance of the object at any instance in time. This method sets the phConditionCounter::m_wake variable to 1 so that when any waiting thread recieves the broadcast, it will know that the broadcast was part of the wake up procedure. The last thread that exits the phConditionCounter::waitForValue() method will reset the phConditionCounter::m_wakeup variable to 0.

If any new thread goes into the waitForValue section while phConditionCounter::m_wake is set, they will drop through. If someone comes around after phConditionCounter::m_wake is reset by the last thread that was blocked in phConditionCounter::waitForValue(), those threads will likely block on the condition and not wakeup.

Returns:
The success value of the broadcast.
Return values:
phSUCCESS The condition variable broadcast was successful and the phConditionCounter::m_wake variable was set to 1.
phFAIL An error occured sending the broadcast signal to wakeup all the waiting threads.

Definition at line 102 of file phConditionCounter.cpp.





Copyright (C) 2002 - 2007 Philip D.S. Thoren ( pthoren@users.sourceforge.net )
University Of Massachusetts at Lowell
Robotics Lab
SourceForge.net Logo

Generated on Sat Jun 16 02:44:49 2007 for phission by  doxygen 1.4.4