Convenient adapter for class ICond.
More...
#include <Cond.h>
|
| Cond () |
| Default constructor. More...
|
|
| Cond (ICond *icond) |
| Creates a cond adapter from out of an abstract interface. More...
|
|
void | wait (Mutex &mutex) |
| The calling thread will wait until the condition variable is signaled by another thread. More...
|
|
void | signal () |
| Resumes at least one single thread that is waiting for the condition. More...
|
|
void | broadcast () |
| Resumes all threads that are waiting for the condition. More...
|
|
ICond * | interface () |
| Returns the abstract interface used by the adapter.
|
|
Convenient adapter for class ICond.
- Note
- This class is useful to write code that follow the design pattern
- See Also
- Resource Acquisition Is Initialization
Default constructor.
Builds a condition variable by calling the method ICond::create() and then hosts the returned abstract interface to destroy it during the object destruction.
Cond::Cond |
( |
ICond * |
icond | ) |
|
|
inline |
Creates a cond adapter from out of an abstract interface.
- Parameters
-
icond | Object implementing the abstract interface ICond. |
- Precondition
- Parameter icond is not null.
Resumes all threads that are waiting for the condition.
Calling the method without no threads waiting for signals have no effect.
Resumes at least one single thread that is waiting for the condition.
Calling the method without no threads waiting for signals have no effect.
void Cond::wait |
( |
Mutex & |
mutex | ) |
|
|
inline |
The calling thread will wait until the condition variable is signaled by another thread.
This method atomically performs this steps:
- unlocks the passed mutex.
- wait for a signal from another thread (see methods signal and broadcast).
- locks again the mutex.
- Parameters
-
mutex | The mutex to be unlocked/locked. |
- Precondition
- The passed mutex is currently locked by the calling thread.
- Postcondition
- The passed mutex is locked back by the calling thread.
The documentation for this class was generated from the following file: