Polling every 10ms there's not much point checking the pthread_cond_timedwait as it just adds overhead. Simply check the value of work_restart in the bfl main polling loop.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
diff --git a/driver-bitforce.c b/driver-bitforce.c
index 902b5a3..bc5181c 100644
--- a/driver-bitforce.c
+++ b/driver-bitforce.c
@@ -137,10 +137,10 @@ static uint64_t bitforce_scanhash(struct thr_info *thr, struct work *work, uint6
struct cgpu_info *bitforce = thr->cgpu;
int fdDev = bitforce->device_fd;
+ int i, thr_id = thr->id;
char pdevbuf[0x100];
unsigned char ob[61] = ">>>>>>>>12345678901234567890123456789012123456789012>>>>>>>>";
struct timeval tdiff;
- int i;
char *pnoncebuf;
char *s;
uint32_t nonce;
@@ -215,8 +215,13 @@ static uint64_t bitforce_scanhash(struct thr_info *thr, struct work *work, uint6
/* Now start looking for results. Stupid polling every 10ms... */
tdiff.tv_sec = 0;
tdiff.tv_usec = 10000;
+
+ work_restart[thr_id].restart = 0;
while (42) {
- int rc = restart_wait(&tdiff);
+ if (unlikely(work_restart[thr_id].restart))
+ return 0;
+ usleep(10000);
+ i += 10;
BFwrite(fdDev, "ZFX", 3);
BFgets(pdevbuf, sizeof(pdevbuf), fdDev);
@@ -226,9 +231,6 @@ static uint64_t bitforce_scanhash(struct thr_info *thr, struct work *work, uint6
}
if (pdevbuf[0] != 'B')
break;
- if (!rc)
- return 0;
- i += 10;
}
applog(LOG_DEBUG, "BitForce waited %dms until %s\n", i, pdevbuf);
work->blk.nonce = 0xffffffff;