Honeycomb  0.1
Component-Model Framework
Condition.h
Go to the documentation of this file.
1 // Honeycomb, Copyright (C) 2013 Daniel Carter. Distributed under the Boost Software License v1.0.
2 #pragma once
3 
5 namespace honey
6 {
7 
8 class SpinLock;
9 
10 namespace platform
11 {
12 
13 class Condition
14 {
15 public:
16  Condition();
17  virtual ~Condition();
18 
19  void signal();
20  void broadcast();
21 
22  void wait(UniqueLock<honey::Mutex>& lock) { wait(lock, honey::MonoClock::TimePoint::max); }
23  bool wait(UniqueLock<honey::Mutex>& lock, honey::MonoClock::Duration time) { return wait(lock, honey::MonoClock::now() + time); }
24  bool wait(UniqueLock<honey::Mutex>& external, honey::MonoClock::TimePoint time);
25 
26 private:
27  int _waitCount;
28  UniquePtr<SpinLock> _waitLock;
29  HANDLE _sema;
30  HANDLE _timer;
31  HANDLE _waitDone;
32  bool _broadcast;
33 };
34 
35 } }
static TimePoint now()
Get current time.
Definition: Clock.h:48
Super::TimePoint TimePoint
Definition: Clock.h:40
TimePoint::Duration Duration
Definition: Clock.h:41
Global Honeycomb namespace.