Browse Source

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

nfactor-troky
Con Kolivas 14 years ago
parent
commit
8220af8806
  1. 13
      main.c

13
main.c

@ -991,6 +991,16 @@ static int requests_staged(void) @@ -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) @@ -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 */

Loading…
Cancel
Save