mirror of
https://github.com/GOSTSec/sgminer
synced 2025-09-03 09:42:17 +00:00
Make sure a GPU doesn't work on a block longer than opt_scantime.
This commit is contained in:
parent
26546ad5b9
commit
b19ee2f5f5
@ -833,12 +833,13 @@ static void *gpuminer_thread(void *userdata)
|
|||||||
localThreads[0] = clState->max_work_size / vectors;
|
localThreads[0] = clState->max_work_size / vectors;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
struct timeval tv_end, diff;
|
struct timeval tv_end, diff, tv_workstart;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
clFinish(clState->commandQueue);
|
clFinish(clState->commandQueue);
|
||||||
|
|
||||||
if (need_work) {
|
if (need_work) {
|
||||||
|
gettimeofday(&tv_workstart, NULL);
|
||||||
/* obtain new work from internal workio thread */
|
/* obtain new work from internal workio thread */
|
||||||
if (unlikely(!get_work(mythr, work))) {
|
if (unlikely(!get_work(mythr, work))) {
|
||||||
applog(LOG_ERR, "work retrieval failed, exiting "
|
applog(LOG_ERR, "work retrieval failed, exiting "
|
||||||
@ -897,6 +898,11 @@ static void *gpuminer_thread(void *userdata)
|
|||||||
gettimeofday(&tv_start, NULL);
|
gettimeofday(&tv_start, NULL);
|
||||||
|
|
||||||
work->blk.nonce += hashes_done;
|
work->blk.nonce += hashes_done;
|
||||||
|
timeval_subtract(&diff, &tv_end, &tv_workstart);
|
||||||
|
if (diff.tv_sec > opt_scantime) {
|
||||||
|
need_work = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (unlikely(work->blk.nonce > MAXTHREADS - hashes_done) ||
|
if (unlikely(work->blk.nonce > MAXTHREADS - hashes_done) ||
|
||||||
(work_restart[thr_id].restart))
|
(work_restart[thr_id].restart))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user