1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-11 07:17:58 +00:00

Overlap queued decrementing with staged incrementing.

This commit is contained in:
Con Kolivas 2012-08-16 09:19:45 +10:00
parent 9f1d9ce3b7
commit 5fadfdb219
2 changed files with 12 additions and 2 deletions

View File

@ -2427,7 +2427,7 @@ static void *get_work_thread(void *userdata)
} }
fail_pause = opt_fail_pause; fail_pause = opt_fail_pause;
dec_queued(pool); ret_work->queued = true;
} }
applog(LOG_DEBUG, "Pushing work to requesting thread"); applog(LOG_DEBUG, "Pushing work to requesting thread");
@ -2890,7 +2890,12 @@ static int tv_sort(struct work *worka, struct work *workb)
static bool hash_push(struct work *work) static bool hash_push(struct work *work)
{ {
bool rc = true; bool rc = true, dec = false;
if (work->queued) {
work->queued = false;
dec = true;
}
mutex_lock(stgd_lock); mutex_lock(stgd_lock);
if (likely(!getq->frozen)) { if (likely(!getq->frozen)) {
@ -2901,6 +2906,10 @@ static bool hash_push(struct work *work)
rc = false; rc = false;
pthread_cond_signal(&getq->cond); pthread_cond_signal(&getq->cond);
mutex_unlock(stgd_lock); mutex_unlock(stgd_lock);
if (dec)
dec_queued(work->pool);
return rc; return rc;
} }

View File

@ -795,6 +795,7 @@ struct work {
bool stale; bool stale;
bool mandatory; bool mandatory;
bool block; bool block;
bool queued;
unsigned int work_block; unsigned int work_block;
int id; int id;