small changes
[c11tester.git] / futex.cc
index ce130446f8455f19e6adfe6e7512311e5e7b7def..677b4afd9fe29740aacd604566d8811da833d06f 100644 (file)
--- a/futex.cc
+++ b/futex.cc
@@ -45,8 +45,8 @@ namespace std _GLIBCXX_VISIBILITY(default)
 
                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);
@@ -61,10 +61,14 @@ 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);
+
+               if (v == NULL)
+                       return;// do nothing
+
                v->notify_all();
        }
 
        _GLIBCXX_END_NAMESPACE_VERSION
 }
-#endif// defined(_GLIBCXX_HAVE_LINUX_FUTEX) && ATOMIC_INT_LOCK_FREE > 1
-#endif// _GLIBCXX_HAS_GTHREADS
+#endif // defined(_GLIBCXX_HAVE_LINUX_FUTEX) && ATOMIC_INT_LOCK_FREE > 1
+#endif // _GLIBCXX_HAS_GTHREADS