From 5aca762a97bdcea830f388efb7a473a1acb5d6ed Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Wed, 31 Aug 2011 16:01:28 +1000 Subject: [PATCH] Go back to requesting work 2/3 of the way through the current scantime with CPU mining as reports of mining threads running out of work have occurred with only 5 seconds to retrieve work. --- main.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/main.c b/main.c index c5327b49..f9020144 100644 --- a/main.c +++ b/main.c @@ -3303,20 +3303,13 @@ static void *miner_thread(void *userdata) bool needs_work = true; /* Try to cycle approximately 5 times before each log update */ const unsigned long cycle = opt_log_interval / 5 ? : 1; - int request_interval; + unsigned const int request_interval = opt_scantime * 2 / 3 ? : 1; bool requested = false; uint32_t nonce_inc = max_nonce, hash_div = 1; double hash_divfloat = 1.0; pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - /* Request the next work item just before the end of the scantime. We - * don't want the work lying around too long since the CPU will always - * spend the full scantime */ - request_interval = opt_scantime - 5; - if (request_interval < 1) - request_interval = 1; - /* Set worker threads to nice 19 and then preferentially to SCHED_IDLE * and if that fails, then SCHED_BATCH. No need for this to be an * error if it fails */