schedule: improve scheduler printing
[model-checker.git] / conditionvariable.cc
1 #include <mutex>
2 #include "model.h"
3 #include <condition_variable>
4
5
6 namespace std {
7
8 condition_variable::condition_variable() {
9                 
10 }
11
12 void condition_variable::notify_one() {
13         model->switch_to_master(new ModelAction(ATOMIC_NOTIFY_ONE, std::memory_order_seq_cst, this));
14 }
15
16 void condition_variable::notify_all() {
17         model->switch_to_master(new ModelAction(ATOMIC_NOTIFY_ALL, std::memory_order_seq_cst, this));
18 }
19
20 void condition_variable::wait(mutex& lock) {
21         model->switch_to_master(new ModelAction(ATOMIC_WAIT, std::memory_order_seq_cst, this, (uint64_t) &lock));
22         //relock as a second action
23         lock.lock();
24 }
25 }
26