Do not report deadlock on relocking a recursive mutex; lock count not implemented yet
[c11tester.git] / pthread.cc
index 706f1b75602ef6ae33e2876be5064dcd10ab18a3..50214c34b31d6d578e4d732c11865eab9b3a3a89 100644 (file)
@@ -66,13 +66,18 @@ void pthread_exit(void *value_ptr) {
        real_pthread_exit(NULL);
 }
 
-int pthread_mutex_init(pthread_mutex_t *p_mutex, const pthread_mutexattr_t *) {
+int pthread_mutex_init(pthread_mutex_t *p_mutex, const pthread_mutexattr_t * attr) {
        if (!model) {
                snapshot_system_init(10000, 1024, 1024, 40000);
                model = new ModelChecker();
                model->startChecker();
        }
-       cdsc::snapmutex *m = new cdsc::snapmutex();
+
+       int mutex_type = PTHREAD_MUTEX_DEFAULT;
+       if (attr != NULL)
+               pthread_mutexattr_gettype(attr, &mutex_type);
+
+       cdsc::snapmutex *m = new cdsc::snapmutex(mutex_type);
 
        ModelExecution *execution = model->get_execution();
        execution->getMutexMap()->put(p_mutex, m);