Browse Source

cgsem_post after creating the thread info

Con Kolivas 12 years ago
parent
commit
24398bde03
1 changed files with 14 additions and 14 deletions
  1. 14 14
      cgminer.c

+ 14 - 14
cgminer.c

@@ -7177,13 +7177,6 @@ static void hotplug_process()
 			thr->cgpu = cgpu;
 			thr->device_thread = j;
 
-			/* Enable threads for devices set not to mine but disable
-			 * their queue in case we wish to enable them later */
-			if (cgpu->deven != DEV_DISABLED) {
-				applog(LOG_DEBUG, "Pushing sem post to thread %d", thr->id);
-				cgsem_post(&thr->sem);
-			}
-
 			if (cgpu->drv->thread_prepare && !cgpu->drv->thread_prepare(thr))
 				continue;
 
@@ -7194,6 +7187,13 @@ static void hotplug_process()
 
 			cgpu->thr[j] = thr;
 
+			/* Enable threads for devices set not to mine but disable
+			 * their queue in case we wish to enable them later */
+			if (cgpu->deven != DEV_DISABLED) {
+				applog(LOG_DEBUG, "Pushing sem post to thread %d", thr->id);
+				cgsem_post(&thr->sem);
+			}
+
 			mining_threads++;
 		}
 		total_devices++;
@@ -7668,13 +7668,6 @@ begin_bench:
 			thr->cgpu = cgpu;
 			thr->device_thread = j;
 
-			/* Enable threads for devices set not to mine but disable
-			 * their queue in case we wish to enable them later */
-			if (cgpu->deven != DEV_DISABLED) {
-				applog(LOG_DEBUG, "Pushing sem post to thread %d", thr->id);
-				cgsem_post(&thr->sem);
-			}
-
 			if (!cgpu->drv->thread_prepare(thr))
 				continue;
 
@@ -7684,6 +7677,13 @@ begin_bench:
 				quit(1, "thread %d create failed", thr->id);
 
 			cgpu->thr[j] = thr;
+
+			/* Enable threads for devices set not to mine but disable
+			 * their queue in case we wish to enable them later */
+			if (cgpu->deven != DEV_DISABLED) {
+				applog(LOG_DEBUG, "Pushing sem post to thread %d", thr->id);
+				cgsem_post(&thr->sem);
+			}
 		}
 	}