Browse Source

There is still potential for an uneven number of queued and dropped work items with this unnecessarily complex check. Flush work guarantees a symmetrical number of queue and discard already.

nfactor-troky
Con Kolivas 13 years ago
parent
commit
ed7e5bf9a3
  1. 24
      main.c

24
main.c

@ -771,8 +771,8 @@ static bool get_work(struct work *work, bool queued) @@ -771,8 +771,8 @@ static bool get_work(struct work *work, bool queued)
struct work *work_heap;
bool ret = false;
if (!queued || !requests_queued()) {
if (unlikely(!queue_request()))
if (unlikely(!queued && !queue_request())) {
applog(LOG_ERR, "Failed to queue_request in get_work");
goto out;
}
@ -869,16 +869,6 @@ static void *miner_thread(void *userdata) @@ -869,16 +869,6 @@ static void *miner_thread(void *userdata)
bool rc;
if (needs_work) {
if (work_restart[thr_id].restart) {
if (requested) {
/* We have one extra request than desired now */
if (unlikely(!discard_request())) {
applog(LOG_ERR, "Failed to discard request in uminer thread");
goto out;
}
} else
requested = true;
}
gettimeofday(&tv_workstart, NULL);
/* obtain new work from internal workio thread */
if (unlikely(!get_work(&work, requested))) {
@ -1118,16 +1108,6 @@ static void *gpuminer_thread(void *userdata) @@ -1118,16 +1108,6 @@ static void *gpuminer_thread(void *userdata)
memset(res, 0, BUFFERSIZE);
gettimeofday(&tv_workstart, NULL);
if (work_restart[thr_id].restart) {
if (requested) {
/* We have one extra request than desired now */
if (unlikely(!discard_request())) {
applog(LOG_ERR, "Failed to discard request in gpuminer thread");
goto out;
}
} else
requested = true;
}
/* obtain new work from internal workio thread */
if (unlikely(!get_work(work, requested))) {
applog(LOG_ERR, "work retrieval failed, exiting "

Loading…
Cancel
Save