projects
/
model-checker.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c60bc86
)
libatomic: use 'values' for atomic load/store
author
Brian Norris
<banorris@uci.edu>
Thu, 26 Apr 2012 23:14:27 +0000
(16:14 -0700)
committer
Brian Norris
<banorris@uci.edu>
Thu, 26 Apr 2012 23:14:27 +0000
(16:14 -0700)
libatomic.cc
patch
|
blob
|
history
libatomic.h
patch
|
blob
|
history
diff --git
a/libatomic.cc
b/libatomic.cc
index b607e222dce6c133238e0140162fa0f250c740a1..6734148dc2cdd117998c111903c83b2457b4be29 100644
(file)
--- a/
libatomic.cc
+++ b/
libatomic.cc
@@
-6,11
+6,12
@@
void atomic_store_explicit(struct atomic_object *obj, int value, memory_order or
{
DBG();
model->switch_to_master(new ModelAction(ATOMIC_WRITE, order, obj, value));
+ obj->value = value;
}
int atomic_load_explicit(struct atomic_object *obj, memory_order order)
{
DBG();
model->switch_to_master(new ModelAction(ATOMIC_READ, order, obj, VALUE_NONE));
- return
0
;
+ return
obj->value
;
}
diff --git
a/libatomic.h
b/libatomic.h
index 33cfa624daed766cf78e2402c1e6d2c28403f0a7..684b213d11fc2dc3d6dc9ce307855445f4939c04 100644
(file)
--- a/
libatomic.h
+++ b/
libatomic.h
@@
-15,6
+15,7
@@
extern "C" {
} memory_order;
typedef struct atomic_object {
+ int value;
} atomic_int;
void atomic_store_explicit(struct atomic_object *obj, int value, memory_order order);