From 34a8b735d1de5aafa72277a40ee3280efc32cd4a Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Sun, 29 Apr 2012 12:57:05 -0700 Subject: [PATCH] model: add is_acquire() and is_release() helper functions --- model.cc | 24 ++++++++++++++++++++++++ model.h | 2 ++ 2 files changed, 26 insertions(+) diff --git a/model.cc b/model.cc index f070910..84b296e 100644 --- a/model.cc +++ b/model.cc @@ -261,6 +261,30 @@ bool ModelAction::is_write() return type == ATOMIC_WRITE; } +bool ModelAction::is_acquire() +{ + switch (order) { + case memory_order_acquire: + case memory_order_acq_rel: + case memory_order_seq_cst: + return true; + default: + return false; + } +} + +bool ModelAction::is_release() +{ + switch (order) { + case memory_order_release: + case memory_order_acq_rel: + case memory_order_seq_cst: + return true; + default: + return false; + } +} + bool ModelAction::same_var(ModelAction *act) { return location == act->location; diff --git a/model.h b/model.h index 4472c5b..d04fa62 100644 --- a/model.h +++ b/model.h @@ -39,6 +39,8 @@ public: bool is_read(); bool is_write(); + bool is_acquire(); + bool is_release(); bool same_var(ModelAction *act); bool same_thread(ModelAction *act); bool is_dependent(ModelAction *act); -- 2.34.1