IPrivateCondition
- IPrivateCondition represents an unnamed derivative of the abstract base ICondition class. So see the parent class
for details of what conditions are and how they are used.
IPrivateCondition - Member Functions and Data by Group
Constructors & Destructor
Construct and destruct private condition objects.
- ~IPrivateCondition
public:
virtual ~IPrivateCondition()
- The destructor destroys any internal system services required to implement the condition on each particular platform.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
- Portability Considerations
- The action of destroying a condition on which threads are waiting is undefined and platform specific. The most likely scenario is an 'owner died'
error from the underlying operating system, caused by the underlying system services used to block the waiting threads.
- IPrivateCondition
public:
IPrivateCondition()
- Constructs a private condition object. Private condition constructors have no required parameters. The new private
condition can only be used within the context of the process it is created within.
- Constructs a private condition object. The default constructor is the only available constructor for use.
- Exception
| IConditionInvalid
| if there is any failure to create
the underlying system resources required to implement
the condition.
|
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
Waiting and signalling
Wait on a private condition, or signal other threads which are waiting on a private condition.
- broadcast
- Allows all threads, currently waiting on this condition, to return.
public:
virtual void broadcast()
- Allows all threads, currently waiting on this condition, to return from their wait operations. In some platform
implementations, threads entering wait() while the broadcast is being done might also be allowed to pass on
through, i.e. it does not necessarily take a snapshot of waiting threads.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
- signal
- Signals the condition, which allows a single waiting thread return from the wait() call.
public:
virtual void signal()
- Signals the condition, which allows one other thread return from a wait on the condition. Only one thread is
allowed through, never more. If no threads are waiting, then this has no effect. So signal() is a pulse type
operation, i.e. it does not remain signaled.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
- wait
- Waits for the condition to be signaled or broadcast by another thread of the current process. An optional timeout can be provided,
which defaults to an infinite wait if none is explicitly given.
Overload 1
public:
virtual bool wait(long timeOut = - 1)
- This version does not accept a resource lock object. It just waits for a signal or broadcast from another thread, or times out if one does not arrive before
the passed timeout period.
- timeOut
- The number of milliseconds to wait for the condition to become signaled. Defaults to -1, which
means wait forever.
- Return
- true if the wait succeeded, or false if it timed out. Any other error will result in an IConditionInvalid exception.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
Overload 2
public:
virtual bool wait(IResourceLock& aLock, long timeOut = - 1)
- This version accepts a resource lock object. It is assumed that the calling thread owns this resource lock. The lock will be temporarily release while
the calling thread is blocked on the wait call. When the calling thread is released, either by timeout or a signal or broadcast from another thread, the
lock will be reaquired before returning.
- aLock
- This is a resource lock that will be unlocked for the duration of the wait, and relocked upon return. Its
must be locked upon entry to this method.
- timeOut
- The number of milliseconds to wait for the condition to become signaled. Defaults to -1, which means
wait forever.
- Return
- true if the wait succeeded, or false if it timed out. Any other error will result in an IConditionInvalid exception.
- Supported Platforms
| Windows |
OS/2 |
AIX |
| Yes |
Yes |
Yes |
IPrivateCondition - Inherited Member Functions and Data
Inherited Public Functions
- ICondition
-
virtual ~ICondition()
virtual void broadcast() = 0
static void Relock(IResourceLock&, long times)
virtual void signal() = 0
static long Unlock(IResourceLock&)
virtual bool
wait( IResourceLock& alock,
long timeOut = - 1 ) = 0
virtual bool wait(long timeOut = - 1) = 0
Inherited Public Data
Inherited Protected Functions
- ICondition
-
Inherited Protected Data