/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. module synch.condition;
  11. import platform.vars.mutex;
  12. import platform.vars.condition;
  13. import scaffold.thread;
  14. import synch.mutex;
  15. class Condition {
  16. this() {
  17. ConditionInit(_pfvars);
  18. }
  19. void signal() {
  20. ConditionSignal(_pfvars);
  21. }
  22. void wait() {
  23. ConditionWait(_pfvars);
  24. }
  25. package:
  26. void wait(ref MutexPlatformVars mutexVars) {
  27. ConditionWait(_pfvars, mutexVars);
  28. }
  29. ConditionPlatformVars _pfvars;
  30. }
  31. interface Waitable {
  32. Condition waitCondition();
  33. }