mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-25 22:14:36 +00:00
Discard all work on longpoll, not just work cgminer recognises as stale.
This commit is contained in:
parent
88983306fd
commit
1470eea903
25
cgminer.c
25
cgminer.c
@ -3412,6 +3412,27 @@ static void discard_stale(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void discard_all(struct pool *pool)
|
||||||
|
{
|
||||||
|
struct work *work, *tmp;
|
||||||
|
int discarded = 0;
|
||||||
|
|
||||||
|
mutex_lock(stgd_lock);
|
||||||
|
HASH_ITER(hh, staged_work, work, tmp) {
|
||||||
|
HASH_DEL(staged_work, work);
|
||||||
|
work->pool->staged--;
|
||||||
|
discard_work(work);
|
||||||
|
discarded++;
|
||||||
|
}
|
||||||
|
mutex_unlock(stgd_lock);
|
||||||
|
|
||||||
|
if (discarded) {
|
||||||
|
applog(LOG_DEBUG, "Discarded %d work items by pool %d request", discarded, pool->pool_no);
|
||||||
|
while (discarded-- > 0)
|
||||||
|
queue_request();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* A generic wait function for threads that poll that will wait a specified
|
/* A generic wait function for threads that poll that will wait a specified
|
||||||
* time tdiff waiting on the pthread conditional that is broadcast when a
|
* time tdiff waiting on the pthread conditional that is broadcast when a
|
||||||
* work restart is required. Returns the value of pthread_cond_timedwait
|
* work restart is required. Returns the value of pthread_cond_timedwait
|
||||||
@ -3446,8 +3467,8 @@ static void restart_threads(void)
|
|||||||
* fast enough messages after every long poll */
|
* fast enough messages after every long poll */
|
||||||
pool_tset(cp, &cp->lagging);
|
pool_tset(cp, &cp->lagging);
|
||||||
|
|
||||||
/* Discard staged work that is now stale */
|
/* Force discard all work even if not stale */
|
||||||
discard_stale();
|
discard_all(cp);
|
||||||
|
|
||||||
for (i = 0; i < mining_threads; i++)
|
for (i = 0; i < mining_threads; i++)
|
||||||
thr_info[i].work_restart = true;
|
thr_info[i].work_restart = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user