Merge pull request #229 from luke-jr/modminer_primary modminer: Don't delay 2nd+ FPGAs during work restart
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
diff --git a/cgminer.c b/cgminer.c
index 1540c1b..5dbfc76 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -3829,6 +3829,8 @@ void *miner_thread(void *userdata)
const time_t request_interval = opt_scantime * 2 / 3 ? : 1;
unsigned const long request_nonce = MAXTHREADS / 3 * 2;
bool requested = false;
+ const bool primary = (!mythr->device_thread) || mythr->primary_thread;
+
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
gettimeofday(&getwork_start, NULL);
@@ -3910,7 +3912,7 @@ void *miner_thread(void *userdata)
* starting of every next thread to try and get
* all devices busy before worrying about
* getting work for their extra threads */
- if (mythr->device_thread) {
+ if (!primary) {
struct timespec rgtp;
rgtp.tv_sec = 0;
diff --git a/driver-modminer.c b/driver-modminer.c
index 0afce2d..2d5a1b6 100644
--- a/driver-modminer.c
+++ b/driver-modminer.c
@@ -318,6 +318,8 @@ modminer_fpga_init(struct thr_info *thr)
mutex_unlock(&modminer->device_mutex);
+ thr->primary_thread = true;
+
return true;
}
diff --git a/miner.h b/miner.h
index 08e19c6..00430db 100644
--- a/miner.h
+++ b/miner.h
@@ -391,6 +391,7 @@ struct thread_q {
struct thr_info {
int id;
int device_thread;
+ bool primary_thread;
pthread_t pth;
struct thread_q *q;