qpid::sys::Waitable Class Reference

A monitor that keeps track of waiting threads. More...

#include <Waitable.h>

Inheritance diagram for qpid::sys::Waitable:

Inheritance graph
[legend]
Collaboration diagram for qpid::sys::Waitable:

Collaboration graph
[legend]

List of all members.

Public Member Functions

void waitWaiters ()
 Block till there are no more waiters in ScopedWaits.
size_t hasWaiters () const
 Returns the number of outstanding ScopedWaits.
void setException (const ExceptionHolder &e)
 Set an execption to interrupt waiters in ScopedWait.
bool hasException () const
 True if the waitable has an exception.
void resetException ()
 Clear the exception if any.
void wait ()
 Throws an exception if one is set before or during the wait.
bool wait (const AbsTime &absoluteTime)
 Throws an exception if one is set before or during the wait.

Classes

struct  ScopedWait
 Use this inside a scoped lock around the call to wait() to be counted as a waiter. More...


Detailed Description

A monitor that keeps track of waiting threads.

Threads declare a ScopedWait around wait() inside a ScopedLock to be considered waiters.

Allows waiting threads to be interrupted by an exception.

Definition at line 38 of file Waitable.h.


Member Function Documentation

void qpid::sys::Waitable::waitWaiters (  )  [inline]

Block till there are no more waiters in ScopedWaits.

waitWaiters() does not raise an exception even if waiters were interrupted by one.

Precondition:
Must be called inside a ScopedLock but NOT a ScopedWait.

Definition at line 58 of file Waitable.h.

Referenced by qpid::sys::BlockingQueue< T >::close().

size_t qpid::sys::Waitable::hasWaiters (  )  const [inline]

Returns the number of outstanding ScopedWaits.

Must be called with the lock held.

Definition at line 66 of file Waitable.h.

void qpid::sys::Waitable::setException ( const ExceptionHolder e  )  [inline]

Set an execption to interrupt waiters in ScopedWait.

Must be called with the lock held.

Definition at line 73 of file Waitable.h.

Referenced by qpid::sys::BlockingQueue< T >::close().

void qpid::sys::Waitable::wait (  )  [inline]

bool qpid::sys::Waitable::wait ( const AbsTime absoluteTime  )  [inline]

Throws an exception if one is set before or during the wait.

Reimplemented from qpid::sys::Monitor.

Definition at line 92 of file Waitable.h.


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

Generated on Thu Oct 16 13:38:42 2008 for Qpid by  doxygen 1.5.6