Bug fix for removing ATOMIC_WAIT actions
authorweiyu <weiyuluo1232@gmail.com>
Mon, 6 Jan 2020 21:00:01 +0000 (13:00 -0800)
committerweiyu <weiyuluo1232@gmail.com>
Mon, 6 Jan 2020 21:00:01 +0000 (13:00 -0800)
execution.cc

index 05591751b14a8db61ba0a7e3ff6619c311260e1d..baa5917186df01a86937261c0f61ce833943008c 100644 (file)
@@ -1671,9 +1671,17 @@ void ModelExecution::removeAction(ModelAction *act) {
        }
        {
                sllnode<ModelAction *> * listref = act->getThrdMapRef();
-               if (listref != NULL) {
-                       SnapVector<action_list_t> *vec = get_safe_ptr_vect_action(&obj_thrd_map, act->get_location());
-                       (*vec)[act->get_tid()].erase(listref);
+               if (act->is_wait()) {
+                       if (listref != NULL) {
+                               void *mutex_loc = (void *) act->get_value();
+                               SnapVector<action_list_t> *vec = get_safe_ptr_vect_action(&obj_thrd_map, mutex_loc);
+                               (*vec)[act->get_tid()].erase(listref);
+                       }
+               } else {
+                       if (listref != NULL) {
+                               SnapVector<action_list_t> *vec = get_safe_ptr_vect_action(&obj_thrd_map, act->get_location());
+                               (*vec)[act->get_tid()].erase(listref);
+                       }
                }
        }
        if ((act->is_fence() && act->is_seqcst()) || act->is_unlock()) {