fix mutex_trylock bug
[c11tester.git] / pthread.cc
index e95fb37a3c9b079599b19ca90dd9f00d74fd66b3..e64cd134b91f4b4aebf0723adc78e283154b7c50 100644 (file)
@@ -119,7 +119,7 @@ int pthread_mutex_trylock(pthread_mutex_t *p_mutex) {
 
        ModelExecution *execution = model->get_execution();
        cdsc::snapmutex *m = execution->getMutexMap()->get(p_mutex);
-       return m->try_lock();
+       return m->try_lock() ? 0 : EBUSY;
 }
 int pthread_mutex_unlock(pthread_mutex_t *p_mutex) {
        ModelExecution *execution = model->get_execution();