X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=conditionvariable.cc;h=9d569e974406dc56831387c4f55e5321151d2739;hb=HEAD;hp=f79cf2a9feacef6c5f1ee3942e5750c58b34eb23;hpb=e7c0c2dc248559b307122db7923df35f7c6d957e;p=c11tester.git diff --git a/conditionvariable.cc b/conditionvariable.cc index f79cf2a9..9d569e97 100644 --- a/conditionvariable.cc +++ b/conditionvariable.cc @@ -1,24 +1,28 @@ -#include +#include "mutex.h" #include "model.h" #include #include "action.h" -namespace std { +namespace cdsc { condition_variable::condition_variable() { - + +} + +condition_variable::~condition_variable() { + } void condition_variable::notify_one() { - model->switch_to_master(new ModelAction(ATOMIC_NOTIFY_ONE, std::memory_order_seq_cst, this)); + model->switch_thread(new ModelAction(ATOMIC_NOTIFY_ONE, std::memory_order_seq_cst, this)); } void condition_variable::notify_all() { - model->switch_to_master(new ModelAction(ATOMIC_NOTIFY_ALL, std::memory_order_seq_cst, this)); + model->switch_thread(new ModelAction(ATOMIC_NOTIFY_ALL, std::memory_order_seq_cst, this)); } void condition_variable::wait(mutex& lock) { - model->switch_to_master(new ModelAction(ATOMIC_WAIT, std::memory_order_seq_cst, this, (uint64_t) &lock)); + model->switch_thread(new ModelAction(ATOMIC_WAIT, std::memory_order_seq_cst, this, (uint64_t) &lock)); //relock as a second action lock.lock(); }