Unlock mutex before exiting in case of error (fixes #340)

This commit is contained in:
Wolfgang Hommel
2021-07-17 19:44:20 +02:00
parent 2090f5e548
commit 4bab3179ce

View File

@@ -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);