1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-03-13 06:01:03 +00:00

Avoid queueing extra work if there's work staged as well.

This commit is contained in:
Con Kolivas 2011-07-18 20:22:16 +10:00
parent c3e569ed9b
commit 8220af8806

13
main.c
View File

@ -991,6 +991,16 @@ static int requests_staged(void)
return ret;
}
static int real_staged(void)
{
int ret;
pthread_mutex_lock(&stgd_lock);
ret = total_staged - lp_staged;
pthread_mutex_unlock(&stgd_lock);
return ret;
}
static void set_curblock(char *hexstr)
{
struct timeval tv_now;
@ -1198,11 +1208,12 @@ static int requests_queued(void)
static bool queue_request(void)
{
int maxq = opt_queue + mining_threads;
struct workio_cmd *wc;
/* If we've been generating lots of local work we may already have
* enough in the queue */
if (requests_queued() >= opt_queue + mining_threads)
if (requests_queued() >= maxq || real_staged() >= maxq)
return true;
/* fill out work request message */