If you can read this text, it means you are not experiencing this website at its best. This website is designed for used with a standards-compliant browser.
Current version: 2.3.2
ZThreads
A platform-independent, multi-threading and synchronization library for C++
Home Documentation Downloads CVS Contact
Waitable Class Referenceabstract

#include <Waitable.h>

Inheritance diagram for Waitable:
Barrier< Count, LockType > Condition Executor PriorityCondition Thread ConcurrentExecutor PoolExecutor SynchronousExecutor ThreadedExecutor

Public Member Functions

virtual ~Waitable ()
 Destroy a Waitable object.

 
virtual void wait ()=0
 
virtual bool wait (unsigned long timeout)=0
 

Detailed Description

Author
Eric Crahen http://www.code-foo.com
Date
<2003-07-16T22:16:41-0400>
Version
2.3.0

The Waitable interface defines a common method of adding generic wait semantics to a class.

Waiting

An object implementing the Waitable interface externalizes a mechanism for testing some internal condition. Another object may wait()s for a Waitable object; in doing so, it wait()s for that condition to become true by blocking the caller while the condition is false.

For example, a Condition is Waitable object that extends wait semantics so that wait()ing means a thread is blocked until some external stimulus specifically performs an operation on the Condition to make its internal condition true. (serialization aside)

A Barrier extends wait semantics so that wait()ing mean waiting for other waiters, and may include automatically resetting the condition once a wait is complete.

See also
Condition
Barrier
Executor

Member Function Documentation

◆ wait() [1/2]

virtual void wait ( )
pure virtual

Waiting on an object will generally cause the calling thread to be blocked for some indefinite period of time. The thread executing will not proceed any further until the Waitable object releases it unless or an exception is thrown.

Implemented in Barrier< Count, LockType >, ConcurrentExecutor, Condition, PoolExecutor, PriorityCondition, SynchronousExecutor, Thread, and ThreadedExecutor.

◆ wait() [2/2]

virtual bool wait ( unsigned long  timeout)
pure virtual

Waiting on an object will generally cause the calling thread to be blocked for some indefinite period of time. The thread executing will not proceed any further until the Waitable object releases it unless or an exception is thrown.

Parameters
timeoutmaximum amount of time, in milliseconds, to spend waiting.
Returns
  • true if the set of tasks being wait for complete before timeout milliseconds elapse.
  • false othewise.

Implemented in Barrier< Count, LockType >, ConcurrentExecutor, Condition, PoolExecutor, PriorityCondition, SynchronousExecutor, Thread, and ThreadedExecutor.


The documentation for this class was generated from the following file: