Commit 5aca762a97bdcea830f388efb7a473a1acb5d6ed

Con Kolivas 2011-08-31T16:01:28

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.

diff --git a/main.c b/main.c
index c5327b4..f902014 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 */