X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;ds=inline;f=action.cc;h=be8c4a6c0cdc69bde75fd08436a33705fa9157af;hb=dd989c16bf4ede61142d79737a8f6568aa153fa2;hp=1007e762ee5258305bbd8ef5b403db5a874f17cc;hpb=c1db87fb3d52c93feb22496fe1e8513e35320c3d;p=model-checker.git diff --git a/action.cc b/action.cc index 1007e76..be8c4a6 100644 --- a/action.cc +++ b/action.cc @@ -651,3 +651,17 @@ bool ModelAction::may_read_from(const Promise *promise) const return true; return false; } + +/** + * Only valid for LOCK, TRY_LOCK, UNLOCK, and WAIT operations. + * @return The mutex operated on by this action, if any; otherwise NULL + */ +std::mutex * ModelAction::get_mutex() const +{ + if (is_trylock() || is_lock() || is_unlock()) + return (std::mutex *)get_location(); + else if (is_wait()) + return (std::mutex *)get_value(); + else + return NULL; +}