mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-22 20:44:19 +00:00
Sleep if the avalon buffer is empty and we've requested a read to allow the write thread to take precedence.
This commit is contained in:
parent
0aeb1b5480
commit
9604cbee98
@ -241,6 +241,11 @@ static int avalon_read(struct cgpu_info *avalon, unsigned char *buf,
|
|||||||
char readbuf[AVALON_READBUF_SIZE];
|
char readbuf[AVALON_READBUF_SIZE];
|
||||||
int err, amount, ofs = 2, cp;
|
int err, amount, ofs = 2, cp;
|
||||||
|
|
||||||
|
/* If the buffer is ready to take more work, yield once in case the
|
||||||
|
* write thread is waiting to be scheduled. */
|
||||||
|
if (!avalon_buffer_full(avalon))
|
||||||
|
nmsleep(40);
|
||||||
|
|
||||||
err = usb_read_once_timeout(avalon, readbuf, readsize, &amount, timeout, ep);
|
err = usb_read_once_timeout(avalon, readbuf, readsize, &amount, timeout, ep);
|
||||||
applog(LOG_DEBUG, "%s%i: Get avalon read got err %d",
|
applog(LOG_DEBUG, "%s%i: Get avalon read got err %d",
|
||||||
avalon->drv->name, avalon->device_id, err);
|
avalon->drv->name, avalon->device_id, err);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user