mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-30 16:34:23 +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;
|
struct cgpu_info *bitforce = thr->cgpu;
|
||||||
int fdDev = bitforce->device_fd;
|
int fdDev = bitforce->device_fd;
|
||||||
|
|
||||||
|
int i, thr_id = thr->id;
|
||||||
char pdevbuf[0x100];
|
char pdevbuf[0x100];
|
||||||
unsigned char ob[61] = ">>>>>>>>12345678901234567890123456789012123456789012>>>>>>>>";
|
unsigned char ob[61] = ">>>>>>>>12345678901234567890123456789012123456789012>>>>>>>>";
|
||||||
struct timeval tdiff;
|
struct timeval tdiff;
|
||||||
int i;
|
|
||||||
char *pnoncebuf;
|
char *pnoncebuf;
|
||||||
char *s;
|
char *s;
|
||||||
uint32_t nonce;
|
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... */
|
/* Now start looking for results. Stupid polling every 10ms... */
|
||||||
tdiff.tv_sec = 0;
|
tdiff.tv_sec = 0;
|
||||||
tdiff.tv_usec = 10000;
|
tdiff.tv_usec = 10000;
|
||||||
|
|
||||||
|
work_restart[thr_id].restart = 0;
|
||||||
while (42) {
|
while (42) {
|
||||||
int rc = restart_wait(&tdiff);
|
if (unlikely(work_restart[thr_id].restart))
|
||||||
|
return 0;
|
||||||
|
usleep(10000);
|
||||||
|
i += 10;
|
||||||
|
|
||||||
BFwrite(fdDev, "ZFX", 3);
|
BFwrite(fdDev, "ZFX", 3);
|
||||||
BFgets(pdevbuf, sizeof(pdevbuf), fdDev);
|
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')
|
if (pdevbuf[0] != 'B')
|
||||||
break;
|
break;
|
||||||
if (!rc)
|
|
||||||
return 0;
|
|
||||||
i += 10;
|
|
||||||
}
|
}
|
||||||
applog(LOG_DEBUG, "BitForce waited %dms until %s\n", i, pdevbuf);
|
applog(LOG_DEBUG, "BitForce waited %dms until %s\n", i, pdevbuf);
|
||||||
work->blk.nonce = 0xffffffff;
|
work->blk.nonce = 0xffffffff;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user