From 25d73096cfc14c655f94b01bb235cc5efd1d5696 Mon Sep 17 00:00:00 2001 From: weiyu Date: Fri, 4 Sep 2020 17:20:23 -0700 Subject: [PATCH] fix mutex_trylock bug --- pthread.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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(); -- 2.34.1