tango.core.sync.Condition

The condition module provides a primitive for synchronized condition checking.

License:
BSD style:

Author:
Sean Kelly

class Condition;
This class represents a condition variable as concieved by C.A.R. Hoare. As per Mesa type monitors however, "signal" has been replaced with "notify" to indicate that control is not transferred to the waiter when a notification is sent.

this(Mutex m);
Initializes a condition object which is associated with the supplied mutex object.

Params:
Mutex m The mutex with which this condition will be associated.

Throws:
SyncException on error.

void wait();
Wait until notified.

Throws:
SyncException on error.

bool wait(double period);
Suspends the calling thread until a notification occurs or until the supplied time period has elapsed. The supplied period may be up to a maximum of (uint.max - 1) milliseconds.

Params:
double period The time to wait, in seconds (fractional values are accepted).

In:
period must be less than (uint.max - 1) milliseconds.

Returns:
true if notified before the timeout and false if not.

Throws:
SyncException on error.

void notify();
Notifies one waiter.

Throws:
SyncException on error.

void notifyAll();
Notifies all waiters.

Throws:
SyncException on error.


Page generated by Ddoc. Copyright (C) 2005-2006 Sean Kelly. All rights reserved.