Browse Source

Limit the number of work items we put in the queue.

nfactor-troky
Con Kolivas 14 years ago
parent
commit
4c9171792b
  1. 8
      main.c

8
main.c

@ -1147,6 +1147,11 @@ static bool queue_request(void) @@ -1147,6 +1147,11 @@ static bool queue_request(void)
struct thr_info *thr = &thr_info[0];
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)
return true;
/* fill out work request message */
wc = calloc(1, sizeof(*wc));
if (unlikely(!wc)) {
@ -1163,6 +1168,7 @@ static bool queue_request(void) @@ -1163,6 +1168,7 @@ static bool queue_request(void)
workio_cmd_free(wc);
return false;
}
getwork_requested++;
inc_queued();
return true;
}
@ -1233,8 +1239,6 @@ static bool get_work(struct work *work, bool queued) @@ -1233,8 +1239,6 @@ static bool get_work(struct work *work, bool queued)
bool ret = false;
int failures = 0;
getwork_requested++;
retry:
if (unlikely(!queued && !queue_request())) {
applog(LOG_WARNING, "Failed to queue_request in get_work");

Loading…
Cancel
Save