X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=pthread.cc;h=50214c34b31d6d578e4d732c11865eab9b3a3a89;hb=cae88a8c7de282bc4c76fa5c75e5f37107bcd5d0;hp=706f1b75602ef6ae33e2876be5064dcd10ab18a3;hpb=3e2ec3ed4b37f4e6aa8e5e0e9e3241890948c3ac;p=c11tester.git diff --git a/pthread.cc b/pthread.cc index 706f1b75..50214c34 100644 --- a/pthread.cc +++ b/pthread.cc @@ -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);