mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-08 22:08:02 +00:00
immediately exit threads if doing hard reset
This commit is contained in:
parent
19fcb5eae7
commit
deacbdd65e
14
sgminer.c
14
sgminer.c
@ -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)
|
||||
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
|
||||
@ -8009,7 +8017,7 @@ static void restart_mining_threads(unsigned int new_n_threads)
|
||||
for (i = 0; i < mining_threads; i++)
|
||||
{
|
||||
applog(LOG_DEBUG, "Shutting down thread %d", i);
|
||||
mining_thr[i]->cgpu->shutdown = true;
|
||||
mining_thr[i]->cgpu->shutdown = true;
|
||||
}
|
||||
rd_unlock(&mining_thr_lock);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user