Execute driver shutdown sequence during kill_work.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
diff --git a/cgminer.c b/cgminer.c
index 5ca8a56..fecdacb 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -2813,6 +2813,12 @@ static void __kill_work(void)
pthread_t *pth = NULL;
thr = get_thread(i);
+ if (thr) {
+ struct device_drv *drv = thr->cgpu->drv;
+
+ drv->thread_shutdown(thr);
+ }
+
if (thr && PTH(thr) != 0L)
pth = &thr->pth;
thr_info_cancel(thr);
@@ -5661,7 +5667,7 @@ static void hash_sole_work(struct thr_info *mythr)
sdiff.tv_sec = sdiff.tv_usec = 0;
cgtime(&tv_lastupdate);
- while (42) {
+ while (likely(!cgpu->shutdown)) {
struct work *work = get_work(mythr, thr_id);
int64_t hashes;
@@ -5937,7 +5943,7 @@ void hash_queued_work(struct thr_info *mythr)
const int thr_id = mythr->id;
int64_t hashes_done = 0;
- while (42) {
+ while (likely(!cgpu->shutdown)) {
struct timeval diff;
int64_t hashes;
diff --git a/miner.h b/miner.h
index 7daba4b..0a04e42 100644
--- a/miner.h
+++ b/miner.h
@@ -542,6 +542,8 @@ struct cgpu_info {
pthread_rwlock_t qlock;
struct work *queued_work;
unsigned int queued_count;
+
+ bool shutdown;
};
extern bool add_cgpu(struct cgpu_info*);