From df5d196f9aec402d7e018a9fb20f2358a41222d5 Mon Sep 17 00:00:00 2001 From: ckolivas Date: Mon, 2 Jul 2012 12:37:15 +1000 Subject: [PATCH] Must unlock mutex if pthread_cond_wait succeeds. --- cgminer.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cgminer.c b/cgminer.c index 043ee126..753d5a39 100644 --- a/cgminer.c +++ b/cgminer.c @@ -2486,13 +2486,17 @@ int restart_wait(struct timeval *tdiff) { struct timeval now, then; struct timespec abstime; + int rc; gettimeofday(&now, NULL); timeradd(&now, tdiff, &then); abstime.tv_sec = then.tv_sec; abstime.tv_nsec = then.tv_usec * 1000; mutex_lock(&restart_lock); - return pthread_cond_timedwait(&restart_cond, &restart_lock, &abstime); + rc = pthread_cond_timedwait(&restart_cond, &restart_lock, &abstime); + if (!rc) + mutex_unlock(&restart_lock); + return rc; } static void restart_threads(void)