From 4bab3179ce148c7c182ac6d775c75ff45081c290 Mon Sep 17 00:00:00 2001 From: Wolfgang Hommel Date: Sat, 17 Jul 2021 19:44:20 +0200 Subject: Unlock mutex before exiting in case of error (fixes #340) --- test/timetest.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/timetest.c b/test/timetest.c index e7751c3..89e372d 100644 --- a/test/timetest.c +++ b/test/timetest.c @@ -83,6 +83,7 @@ void* pthread_test(void* args) if (rt != ETIMEDOUT) { printf("pthread_cond_timedwait failed\n"); + pthread_mutex_unlock(&fakeMutex); exit(EXIT_FAILURE); } pthread_mutex_unlock(&fakeMutex); @@ -105,6 +106,7 @@ void* pthread_test(void* args) if (rt != ETIMEDOUT) { printf("pthread_cond_timedwait failed\n"); + pthread_mutex_unlock(&fakeMutex); exit(EXIT_FAILURE); } pthread_mutex_unlock(&fakeMutex); -- cgit v1.2.1