mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-30 00:14:26 +00:00
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.
This commit is contained in:
parent
fd7b21ed56
commit
b1cdacdead
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user