From: weiyu Date: Sat, 5 Sep 2020 00:20:23 +0000 (-0700) Subject: fix mutex_trylock bug X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=commitdiff_plain;h=25d73096cfc14c655f94b01bb235cc5efd1d5696 fix mutex_trylock bug --- diff --git a/pthread.cc b/pthread.cc index e95fb37a..e64cd134 100644 --- a/pthread.cc +++ b/pthread.cc @@ -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();