Browse Source

Must unlock mutex if pthread_cond_wait succeeds.

ckolivas 13 years ago
parent
commit
df5d196f9a
1 changed files with 5 additions and 1 deletions
  1. 5 1
      cgminer.c

+ 5 - 1
cgminer.c

@@ -2486,13 +2486,17 @@ int restart_wait(struct timeval *tdiff)
 {
 {
 	struct timeval now, then;
 	struct timeval now, then;
 	struct timespec abstime;
 	struct timespec abstime;
+	int rc;
 
 
 	gettimeofday(&now, NULL);
 	gettimeofday(&now, NULL);
 	timeradd(&now, tdiff, &then);
 	timeradd(&now, tdiff, &then);
 	abstime.tv_sec = then.tv_sec;
 	abstime.tv_sec = then.tv_sec;
 	abstime.tv_nsec = then.tv_usec * 1000;
 	abstime.tv_nsec = then.tv_usec * 1000;
 	mutex_lock(&restart_lock);
 	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)
 static void restart_threads(void)