Browse Source

Bugfix: Don't report failure for graceful mining thread shutdown

Luke Dashjr 12 years ago
parent
commit
6b173791f7
3 changed files with 9 additions and 8 deletions
  1. 3 2
      deviceapi.c
  2. 5 5
      miner.c
  3. 1 1
      miner.h

+ 3 - 2
deviceapi.c

@@ -566,6 +566,7 @@ void *miner_thread(void *userdata)
 		dev_error(cgpu, REASON_THREAD_FAIL_INIT);
 		for (struct cgpu_info *slave = cgpu->next_proc; slave && !slave->threads; slave = slave->next_proc)
 			dev_error(slave, REASON_THREAD_FAIL_INIT);
+		__thr_being_msg(LOG_ERR, mythr, "failure, exiting");
 		goto out;
 	}
 
@@ -577,14 +578,14 @@ void *miner_thread(void *userdata)
 		drv->minerloop(mythr);
 	else
 		minerloop_scanhash(mythr);
-	cgpu->deven = DEV_DISABLED;
+	__thr_being_msg(LOG_NOTICE, mythr, "shutting down");
 
 out:
+	cgpu->deven = DEV_DISABLED;
 	if (drv->thread_shutdown)
 		drv->thread_shutdown(mythr);
 
 	thread_reportin(mythr);
-	__thr_being_msg(mythr, "failure, exiting");
 	notifier_destroy(mythr->notifier);
 
 	return NULL;

+ 5 - 5
miner.c

@@ -7171,14 +7171,14 @@ bool abandon_work(struct work *work, struct timeval *wdiff, uint64_t hashes)
 	return false;
 }
 
-void __thr_being_msg(struct thr_info *thr, const char *being)
+void __thr_being_msg(int prio, struct thr_info *thr, const char *being)
 {
 	struct cgpu_info *proc = thr->cgpu;
 	
 	if (proc->threads > 1)
-		applog(LOG_WARNING, "%"PRIpreprv" (thread %d) %s", proc->proc_repr, thr->id, being);
+		applog(prio, "%"PRIpreprv" (thread %d) %s", proc->proc_repr, thr->id, being);
 	else
-		applog(LOG_WARNING, "%"PRIpreprv" %s", proc->proc_repr, being);
+		applog(prio, "%"PRIpreprv" %s", proc->proc_repr, being);
 }
 
 void mt_disable_start(struct thr_info *mythr)
@@ -7189,7 +7189,7 @@ void mt_disable_start(struct thr_info *mythr)
 	mythr->prev_work = mythr->work;
 	mythr->work = NULL;
 	mythr->_job_transition_in_progress = false;
-	__thr_being_msg(mythr, "being disabled");
+	__thr_being_msg(LOG_WARNING, mythr, "being disabled");
 	mythr->rolling = mythr->cgpu->rolling = 0;
 	thread_reportout(mythr);
 }
@@ -7372,7 +7372,7 @@ void mt_disable_finish(struct thr_info *mythr)
 	struct device_drv *drv = mythr->cgpu->drv;
 	
 	thread_reportin(mythr);
-	__thr_being_msg(mythr, "being re-enabled");
+	__thr_being_msg(LOG_WARNING, mythr, "being re-enabled");
 	if (drv->thread_enable)
 		drv->thread_enable(mythr);
 }

+ 1 - 1
miner.h

@@ -906,7 +906,7 @@ extern void set_target(unsigned char *dest_target, double diff);
 extern void kill_work(void);
 extern void app_restart(void);
 
-extern void __thr_being_msg(struct thr_info *, const char *);
+extern void __thr_being_msg(int prio, struct thr_info *, const char *);
 extern void mt_enable(struct thr_info *thr);
 extern void proc_enable(struct cgpu_info *);
 extern void reinit_device(struct cgpu_info *cgpu);