Commit 61328a42921da2e2351a88152a89391dff02cada

Con Kolivas 2012-02-17T23:10:01

Stop the mining threads before trying to kill them.

diff --git a/cgminer.c b/cgminer.c
index 2ffa132..f6eebbb 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -1702,10 +1702,19 @@ void kill_work(void)
 	thr = &thr_info[watchdog_thr_id];
 	thr_info_cancel(thr);
 
-	applog(LOG_DEBUG, "Killing off mining threads");
+	applog(LOG_DEBUG, "Stopping mining threads");
 	/* Stop the mining threads*/
 	for (i = 0; i < mining_threads; i++) {
 		thr = &thr_info[i];
+		thr->pause = true;
+	}
+
+	sleep(1);
+
+	applog(LOG_DEBUG, "Killing off mining threads");
+	/* Kill the mining threads*/
+	for (i = 0; i < mining_threads; i++) {
+		thr = &thr_info[i];
 		thr_info_cancel(thr);
 	}