Change initialize a bit
[c11tester.git] / futex.cc
index b92981119ec5132a00da44348ac5695f104cc31a..677b4afd9fe29740aacd604566d8811da833d06f 100644 (file)
--- a/futex.cc
+++ b/futex.cc
@@ -45,8 +45,8 @@ namespace std _GLIBCXX_VISIBILITY(default)
 
                ModelExecution *execution = model->get_execution();
 
 
                ModelExecution *execution = model->get_execution();
 
-               cdsc::condition_variable *v = new cdsc::condition_variable();
-               cdsc::mutex *m = new cdsc::mutex();
+               cdsc::snapcondition_variable *v = new cdsc::snapcondition_variable();
+               cdsc::snapmutex *m = new cdsc::snapmutex();
 
                execution->getCondMap()->put( (pthread_cond_t *) __addr, v);
                execution->getMutexMap()->put( (pthread_mutex_t *) __addr, m);
 
                execution->getCondMap()->put( (pthread_cond_t *) __addr, v);
                execution->getMutexMap()->put( (pthread_mutex_t *) __addr, m);
@@ -61,6 +61,10 @@ namespace std _GLIBCXX_VISIBILITY(default)
                // INT_MAX wakes all the waiters at the address __addr
                ModelExecution *execution = model->get_execution();
                cdsc::condition_variable *v = execution->getCondMap()->get( (pthread_cond_t *) __addr);
                // INT_MAX wakes all the waiters at the address __addr
                ModelExecution *execution = model->get_execution();
                cdsc::condition_variable *v = execution->getCondMap()->get( (pthread_cond_t *) __addr);
+
+               if (v == NULL)
+                       return;// do nothing
+
                v->notify_all();
        }
 
                v->notify_all();
        }