Browse Source

immediately exit threads if doing hard reset

djm34
Jan Berdajs 10 years ago
parent
commit
deacbdd65e
  1. 12
      sgminer.c

12
sgminer.c

@ -6505,7 +6505,8 @@ static void get_work_prepare_thread(struct thr_info *mythr, struct work *work) @@ -6505,7 +6505,8 @@ static void get_work_prepare_thread(struct thr_info *mythr, struct work *work)
if (unlikely(pthread_create(&restart_thr, NULL, restart_mining_threads_thread, (void *) (intptr_t) n_threads)))
quit(1, "restart_mining_threads create thread failed");
// go wait with the other threads...
applog(LOG_DEBUG, "Hard reset: Exiting mining thread %d", mythr->id);
pthread_exit(NULL);
}
else
{
@ -6521,9 +6522,16 @@ static void get_work_prepare_thread(struct thr_info *mythr, struct work *work) @@ -6521,9 +6522,16 @@ static void get_work_prepare_thread(struct thr_info *mythr, struct work *work)
return;
}
}
else
else {
bool hard_reset = opt_isset(pool_switch_options, SWITCHER_HARD_RESET);
mutex_unlock(&algo_switch_lock);
if (hard_reset) {
applog(LOG_DEBUG, "Hard reset: Exiting mining thread %d", mythr->id);
pthread_exit(NULL);
}
}
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
// Set cleanup instructions in the event that the thread is cancelled

Loading…
Cancel
Save