From b1cdacdead258692c12af5949242c5d58ef3c0ee Mon Sep 17 00:00:00 2001 From: ckolivas Date: Mon, 2 Jul 2012 11:28:26 +1000 Subject: [PATCH] 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. --- driver-bitforce.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/driver-bitforce.c b/driver-bitforce.c index 902b5a36..bc5181c4 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;