PageRenderTime 18ms CodeModel.GetById 13ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/synch/condition.d

http://github.com/wilkie/djehuty
D | 44 lines | 24 code | 11 blank | 9 comment | 0 complexity | ac10664bbab0cdbd4f8ba137abe80f51 MD5 | raw file
 1/*
 2 * condition.d
 3 *
 4 * This module implements a conditional wait object.
 5 *
 6 * Author: Dave Wilkinson
 7 * Originated: December 4th, 2009
 8 *
 9 */
10
11module synch.condition;
12
13import platform.vars.mutex;
14import platform.vars.condition;
15
16import scaffold.thread;
17
18import synch.mutex;
19
20class Condition {
21	this() {
22		ConditionInit(_pfvars);
23	}
24
25	void signal() {
26		ConditionSignal(_pfvars);
27	}
28
29	void wait() {
30		ConditionWait(_pfvars);
31	}
32
33package:
34
35	void wait(ref MutexPlatformVars mutexVars) {
36		ConditionWait(_pfvars, mutexVars);
37	}
38
39	ConditionPlatformVars _pfvars;
40}
41
42interface Waitable {
43	Condition waitCondition();
44}