X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=action.cc;h=f7ca249f965e6b351cd9763f382f9c792d586182;hb=9ba28a8ef15225525c30c5303c859f64602820a3;hp=bf55d0091a2fdb368f5a2caf9727c3f2aab61d6f;hpb=18813c330489a982af8d745450895b0bb4479504;p=model-checker.git diff --git a/action.cc b/action.cc index bf55d00..f7ca249 100644 --- a/action.cc +++ b/action.cc @@ -27,6 +27,22 @@ ModelAction::~ModelAction() delete cv; } +bool ModelAction::is_mutex_op() const { + return type == ATOMIC_LOCK || type == ATOMIC_TRYLOCK || type == ATOMIC_UNLOCK; +} + +bool ModelAction::is_lock() const { + return type == ATOMIC_LOCK; +} + +bool ModelAction::is_unlock() const { + return type == ATOMIC_UNLOCK; +} + +bool ModelAction::is_trylock() const { + return type == ATOMIC_TRYLOCK; +} + bool ModelAction::is_success_lock() const { return type == ATOMIC_LOCK || (type == ATOMIC_TRYLOCK && value == VALUE_TRYSUCCESS); } @@ -175,6 +191,13 @@ void ModelAction::create_cv(const ModelAction *parent) cv = new ClockVector(NULL, this); } +void ModelAction::set_try_lock(bool obtainedlock) { + if (obtainedlock) + value=VALUE_TRYSUCCESS; + else + value=VALUE_TRYFAILED; +} + /** Update the model action's read_from action */ void ModelAction::read_from(const ModelAction *act) {