Commit 3be6ea39e18c222f23d3832920c3f83c14c2fa73

Con Kolivas 2014-01-25T14:06:27

Wait for up to 0.5 seconds in the hashfast scanwork loop if no jobs are required.

diff --git a/driver-hashfast.c b/driver-hashfast.c
index e40e85f..6745c2d 100644
--- a/driver-hashfast.c
+++ b/driver-hashfast.c
@@ -895,8 +895,8 @@ static int64_t hfa_scanwork(struct thr_info *thr)
 {
 	struct cgpu_info *hashfast = thr->cgpu;
 	struct hashfast_info *info = hashfast->device_data;
+	int jobs, ret, cycles = 0;
 	int64_t hashes;
-	int jobs, ret;
 
 	if (unlikely(hashfast->usbinfo.nodev)) {
 		applog(LOG_WARNING, "HFA %d: device disappeared, disabling",
@@ -920,7 +920,9 @@ restart:
 
 	jobs = hfa_jobs(info);
 
-	if (!jobs) {
+	/* Wait on restart_wait for up to 0.5 seconds or submit jobs as soon as
+	 * they're required. */
+	while (!jobs && ++cycles < 5) {
 		ret = restart_wait(thr, 100);
 		if (unlikely(!ret))
 			goto restart;