1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-02-02 10:04:33 +00:00

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

This commit is contained in:
Con Kolivas 2011-07-15 09:48:26 +10:00
parent 32221c4574
commit 4c9171792b

8
main.c
View File

@ -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)
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)
bool ret = false;
int failures = 0;
getwork_requested++;
retry:
if (unlikely(!queued && !queue_request())) {
applog(LOG_WARNING, "Failed to queue_request in get_work");