mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-10 23:08:07 +00:00
klondike - single 'shutdown' and ensure it happens
This commit is contained in:
parent
0e4997a7ae
commit
50c8377305
@ -199,7 +199,6 @@ typedef struct jobque {
|
||||
} JOBQUE;
|
||||
|
||||
struct klondike_info {
|
||||
bool shutdown;
|
||||
pthread_rwlock_t stat_lock;
|
||||
struct thr_info replies_thr;
|
||||
cglock_t klist_lock;
|
||||
@ -540,7 +539,7 @@ static KLIST *GetReply(struct cgpu_info *klncgpu, uint8_t cmd, uint8_t dev)
|
||||
KLIST *kitem;
|
||||
int retries = CMD_REPLY_RETRIES;
|
||||
|
||||
while (retries-- > 0 && klninfo->shutdown == false) {
|
||||
while (retries-- > 0 && klncgpu->shutdown == false) {
|
||||
cgsleep_ms(REPLY_WAIT_TIME);
|
||||
cg_rlock(&klninfo->klist_lock);
|
||||
kitem = klninfo->used;
|
||||
@ -953,7 +952,7 @@ static void *klondike_get_replies(void *userdata)
|
||||
applog(LOG_DEBUG, "%s%i: listening for replies",
|
||||
klncgpu->drv->name, klncgpu->device_id);
|
||||
|
||||
while (klninfo->shutdown == false) {
|
||||
while (klncgpu->shutdown == false) {
|
||||
if (klncgpu->usbinfo.nodev)
|
||||
return NULL;
|
||||
|
||||
@ -1028,7 +1027,7 @@ static void *klondike_get_replies(void *userdata)
|
||||
dev, (char)(kitem->kline.ws.cmd),
|
||||
(int)(kitem->kline.ws.slavecount),
|
||||
slaves);
|
||||
klninfo->shutdown = true;
|
||||
klncgpu->shutdown = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1054,7 +1053,7 @@ static void *klondike_get_replies(void *userdata)
|
||||
klncgpu->drv->name,
|
||||
klncgpu->device_id,
|
||||
dev);
|
||||
klninfo->shutdown = true;
|
||||
klncgpu->shutdown = true;
|
||||
}
|
||||
kln_disable(klncgpu, dev, false);
|
||||
}
|
||||
@ -1157,7 +1156,7 @@ static void klondike_shutdown(struct thr_info *thr)
|
||||
|
||||
kln_disable(klncgpu, klninfo->status[0].kline.ws.slavecount, true);
|
||||
|
||||
klncgpu->shutdown = klninfo->shutdown = true;
|
||||
klncgpu->shutdown = true;
|
||||
}
|
||||
|
||||
static void klondike_thread_enable(struct thr_info *thr)
|
||||
@ -1272,7 +1271,7 @@ static bool klondike_queue_full(struct cgpu_info *klncgpu)
|
||||
rd_unlock(&(klninfo->stat_lock));
|
||||
applog(LOG_ERR, "%s%i:%d reset failed - dropping device",
|
||||
klncgpu->drv->name, klncgpu->device_id, dev);
|
||||
klninfo->shutdown = true;
|
||||
klncgpu->shutdown = true;
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
@ -1360,7 +1359,11 @@ static int64_t klondike_scanwork(struct thr_info *thr)
|
||||
klninfo->noncecount = 0;
|
||||
rd_unlock(&(klninfo->stat_lock));
|
||||
}
|
||||
return newhashcount;
|
||||
|
||||
if (klncgpu->shutdown)
|
||||
return -1;
|
||||
else
|
||||
return newhashcount;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user