From b008782b8c3eb2b845eb9514ae3cdd025fec9c8b Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Tue, 15 May 2012 10:12:04 -0700 Subject: [PATCH] libatomic: place the proper read-value in 'atomic_load' ModelActions Even though I was doing rudimentary loading and storing of atomic values, I didn't properly record the value in the ModelAction. That will be confusing soon if I don't fix it. So fix it. --- libatomic.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libatomic.cc b/libatomic.cc index f552d93d..88d7fbf7 100644 --- a/libatomic.cc +++ b/libatomic.cc @@ -11,9 +11,10 @@ void atomic_store_explicit(struct atomic_object *obj, int value, memory_order or int atomic_load_explicit(struct atomic_object *obj, memory_order order) { + int value = obj->value; DBG(); - model->switch_to_master(new ModelAction(ATOMIC_READ, order, obj, VALUE_NONE)); - return obj->value; + model->switch_to_master(new ModelAction(ATOMIC_READ, order, obj, value)); + return value; } void atomic_init(struct atomic_object *obj, int value) -- 2.34.1