mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-22 12:34:27 +00:00
Freeze the queues on all threads that are sent the pause message to prevent them trying to start up again with saved pings in their queues.
This commit is contained in:
parent
83dde50f9d
commit
06721957a0
@ -1702,6 +1702,7 @@ void kill_work(void)
|
||||
/* Stop the mining threads*/
|
||||
for (i = 0; i < mining_threads; i++) {
|
||||
thr = &thr_info[i];
|
||||
thr_info_freeze(thr);
|
||||
thr->pause = true;
|
||||
}
|
||||
|
||||
|
1
miner.h
1
miner.h
@ -280,6 +280,7 @@ struct thr_info {
|
||||
|
||||
extern int thr_info_create(struct thr_info *thr, pthread_attr_t *attr, void *(*start) (void *), void *arg);
|
||||
extern void thr_info_cancel(struct thr_info *thr);
|
||||
extern void thr_info_freeze(struct thr_info *thr);
|
||||
|
||||
|
||||
struct string_elist {
|
||||
|
24
util.c
24
util.c
@ -668,14 +668,32 @@ int thr_info_create(struct thr_info *thr, pthread_attr_t *attr, void *(*start) (
|
||||
return ret;
|
||||
}
|
||||
|
||||
void thr_info_freeze(struct thr_info *thr)
|
||||
{
|
||||
struct tq_ent *ent, *iter;
|
||||
struct thread_q *tq;
|
||||
|
||||
if (!thr)
|
||||
return;
|
||||
|
||||
tq = thr->q;
|
||||
if (!tq)
|
||||
return;
|
||||
|
||||
mutex_lock(&tq->mutex);
|
||||
tq->frozen = true;
|
||||
list_for_each_entry_safe(ent, iter, &tq->q, q_node) {
|
||||
list_del(&ent->q_node);
|
||||
free(ent);
|
||||
}
|
||||
mutex_unlock(&tq->mutex);
|
||||
}
|
||||
|
||||
void thr_info_cancel(struct thr_info *thr)
|
||||
{
|
||||
if (!thr)
|
||||
return;
|
||||
|
||||
if (thr->q)
|
||||
tq_freeze(thr->q);
|
||||
|
||||
if (PTH(thr) != 0L) {
|
||||
pthread_cancel(thr->pth);
|
||||
PTH(thr) = 0L;
|
||||
|
Loading…
x
Reference in New Issue
Block a user