Remove disabled: label from mining thread function, using a separate mt_disable function.
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 49 50 51 52 53 54
diff --git a/cgminer.c b/cgminer.c
index 56496b2..aae5991 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -3989,6 +3989,20 @@ static inline bool abandon_work(struct work *work, struct timeval *wdiff, uint64
return false;
}
+static void mt_disable(struct thr_info *mythr, const int thr_id,
+ struct device_api *api)
+{
+ applog(LOG_WARNING, "Thread %d being disabled", thr_id);
+ mythr->rolling = mythr->cgpu->rolling = 0;
+ applog(LOG_DEBUG, "Popping wakeup ping in miner thread");
+ thread_reportout(mythr);
+ tq_pop(mythr->q, NULL); /* Ignore ping that's popped */
+ thread_reportin(mythr);
+ applog(LOG_WARNING, "Thread %d being re-enabled", thr_id);
+ if (api->thread_enable)
+ api->thread_enable(mythr);
+}
+
void *miner_thread(void *userdata)
{
struct thr_info *mythr = userdata;
@@ -4111,7 +4125,7 @@ void *miner_thread(void *userdata)
cgpu->device_not_well_reason = REASON_THREAD_ZERO_HASH;
cgpu->thread_zero_hash_count++;
- goto disabled;
+ mt_disable(mythr, thr_id, api);
}
hashes_done += hashes;
@@ -4169,17 +4183,8 @@ void *miner_thread(void *userdata)
tv_lastupdate = tv_end;
}
- if (unlikely(mythr->pause || cgpu->deven != DEV_ENABLED)) {
- applog(LOG_WARNING, "Thread %d being disabled", thr_id);
-disabled:
- mythr->rolling = mythr->cgpu->rolling = 0;
- applog(LOG_DEBUG, "Popping wakeup ping in miner thread");
- thread_reportout(mythr);
- tq_pop(mythr->q, NULL); /* Ignore ping that's popped */
- thread_reportin(mythr);
- applog(LOG_WARNING, "Thread %d being re-enabled", thr_id);
- if (api->thread_enable) api->thread_enable(mythr);
- }
+ if (unlikely(mythr->pause || cgpu->deven != DEV_ENABLED))
+ mt_disable(mythr, thr_id, api);
sdiff.tv_sec = sdiff.tv_usec = 0;
} while (!abandon_work(work, &wdiff, cgpu->max_hashes));