mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-25 14:04:25 +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;
|
} JOBQUE;
|
||||||
|
|
||||||
struct klondike_info {
|
struct klondike_info {
|
||||||
bool shutdown;
|
|
||||||
pthread_rwlock_t stat_lock;
|
pthread_rwlock_t stat_lock;
|
||||||
struct thr_info replies_thr;
|
struct thr_info replies_thr;
|
||||||
cglock_t klist_lock;
|
cglock_t klist_lock;
|
||||||
@ -540,7 +539,7 @@ static KLIST *GetReply(struct cgpu_info *klncgpu, uint8_t cmd, uint8_t dev)
|
|||||||
KLIST *kitem;
|
KLIST *kitem;
|
||||||
int retries = CMD_REPLY_RETRIES;
|
int retries = CMD_REPLY_RETRIES;
|
||||||
|
|
||||||
while (retries-- > 0 && klninfo->shutdown == false) {
|
while (retries-- > 0 && klncgpu->shutdown == false) {
|
||||||
cgsleep_ms(REPLY_WAIT_TIME);
|
cgsleep_ms(REPLY_WAIT_TIME);
|
||||||
cg_rlock(&klninfo->klist_lock);
|
cg_rlock(&klninfo->klist_lock);
|
||||||
kitem = klninfo->used;
|
kitem = klninfo->used;
|
||||||
@ -953,7 +952,7 @@ static void *klondike_get_replies(void *userdata)
|
|||||||
applog(LOG_DEBUG, "%s%i: listening for replies",
|
applog(LOG_DEBUG, "%s%i: listening for replies",
|
||||||
klncgpu->drv->name, klncgpu->device_id);
|
klncgpu->drv->name, klncgpu->device_id);
|
||||||
|
|
||||||
while (klninfo->shutdown == false) {
|
while (klncgpu->shutdown == false) {
|
||||||
if (klncgpu->usbinfo.nodev)
|
if (klncgpu->usbinfo.nodev)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -1028,7 +1027,7 @@ static void *klondike_get_replies(void *userdata)
|
|||||||
dev, (char)(kitem->kline.ws.cmd),
|
dev, (char)(kitem->kline.ws.cmd),
|
||||||
(int)(kitem->kline.ws.slavecount),
|
(int)(kitem->kline.ws.slavecount),
|
||||||
slaves);
|
slaves);
|
||||||
klninfo->shutdown = true;
|
klncgpu->shutdown = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1054,7 +1053,7 @@ static void *klondike_get_replies(void *userdata)
|
|||||||
klncgpu->drv->name,
|
klncgpu->drv->name,
|
||||||
klncgpu->device_id,
|
klncgpu->device_id,
|
||||||
dev);
|
dev);
|
||||||
klninfo->shutdown = true;
|
klncgpu->shutdown = true;
|
||||||
}
|
}
|
||||||
kln_disable(klncgpu, dev, false);
|
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);
|
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)
|
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));
|
rd_unlock(&(klninfo->stat_lock));
|
||||||
applog(LOG_ERR, "%s%i:%d reset failed - dropping device",
|
applog(LOG_ERR, "%s%i:%d reset failed - dropping device",
|
||||||
klncgpu->drv->name, klncgpu->device_id, dev);
|
klncgpu->drv->name, klncgpu->device_id, dev);
|
||||||
klninfo->shutdown = true;
|
klncgpu->shutdown = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1360,7 +1359,11 @@ static int64_t klondike_scanwork(struct thr_info *thr)
|
|||||||
klninfo->noncecount = 0;
|
klninfo->noncecount = 0;
|
||||||
rd_unlock(&(klninfo->stat_lock));
|
rd_unlock(&(klninfo->stat_lock));
|
||||||
}
|
}
|
||||||
return newhashcount;
|
|
||||||
|
if (klncgpu->shutdown)
|
||||||
|
return -1;
|
||||||
|
else
|
||||||
|
return newhashcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user