Browse Source

Bugfix: Set status to LIFE_DEAD2 when killing threads at shut off, to avoid calling driver code

Luke Dashjr 12 years ago
parent
commit
81860ae81f
1 changed files with 9 additions and 6 deletions
  1. 9 6
      miner.c

+ 9 - 6
miner.c

@@ -4494,6 +4494,7 @@ static void disable_curses(void)
 
 static void __kill_work(void)
 {
+	struct cgpu_info *cgpu;
 	struct thr_info *thr;
 	int i;
 
@@ -4523,8 +4524,6 @@ static void __kill_work(void)
 
 	applog(LOG_DEBUG, "Shutting down mining threads");
 	for (i = 0; i < mining_threads; i++) {
-		struct cgpu_info *cgpu;
-
 		thr = get_thread(i);
 		if (!thr)
 			continue;
@@ -4546,11 +4545,15 @@ static void __kill_work(void)
 	/* Kill the mining threads*/
 	for (i = 0; i < mining_threads; i++) {
 		thr = get_thread(i);
-		if (!(thr && thr->cgpu->threads))
+		if (!thr)
 			continue;
-		
-		applog(LOG_WARNING, "Killing %"PRIpreprv, thr->cgpu->proc_repr);
-		thr_info_cancel(thr);
+		cgpu = thr->cgpu;
+		if (cgpu->threads)
+		{
+			applog(LOG_WARNING, "Killing %"PRIpreprv, thr->cgpu->proc_repr);
+			thr_info_cancel(thr);
+		}
+		cgpu->status = LIFE_DEAD2;
 	}
 
 	applog(LOG_DEBUG, "Killing off stage thread");