1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-23 04:54:26 +00:00

Grab clones from hashlist wherever possible first.

This commit is contained in:
Con Kolivas 2012-08-16 10:55:57 +10:00
parent c3e32274ee
commit 55f7c14982

View File

@ -3957,15 +3957,24 @@ static bool queue_request(struct thr_info *thr, bool needed)
static struct work *hash_pop(const struct timespec *abstime) static struct work *hash_pop(const struct timespec *abstime)
{ {
struct work *work = NULL; struct work *work = NULL, *tmp;
int rc = 0; int rc = 0, hc;
mutex_lock(stgd_lock); mutex_lock(stgd_lock);
while (!getq->frozen && !HASH_COUNT(staged_work) && !rc) while (!getq->frozen && !HASH_COUNT(staged_work) && !rc)
rc = pthread_cond_timedwait(&getq->cond, stgd_lock, abstime); rc = pthread_cond_timedwait(&getq->cond, stgd_lock, abstime);
if (HASH_COUNT(staged_work)) { hc = HASH_COUNT(staged_work);
work = staged_work;
if (likely(hc)) {
/* Find clone work if possible, to allow masters to be reused */
if (hc > staged_rollable) {
HASH_ITER(hh, staged_work, work, tmp) {
if (!work_rollable(work))
break;
}
} else
work = staged_work;
HASH_DEL(staged_work, work); HASH_DEL(staged_work, work);
work->pool->staged--; work->pool->staged--;
if (work_rollable(work)) if (work_rollable(work))
@ -4110,7 +4119,6 @@ retry:
pool_resus(pool); pool_resus(pool);
} }
work_heap = clone_work(work_heap);
memcpy(work, work_heap, sizeof(struct work)); memcpy(work, work_heap, sizeof(struct work));
free_work(work_heap); free_work(work_heap);