Browse Source

cpu & opencl: Defer RUNONCE to actual autodetection, so they can be added once after startup

Luke Dashjr 12 years ago
parent
commit
4c03accd0a
2 changed files with 4 additions and 4 deletions
  1. 2 2
      driver-cpu.c
  2. 2 2
      driver-opencl.c

+ 2 - 2
driver-cpu.c

@@ -713,6 +713,8 @@ char *force_nthreads_int(const char *arg, int *i)
 #ifdef WANT_CPUMINE
 static int cpu_autodetect()
 {
+	RUNONCE(0);
+	
 	int i;
 
 	// Reckon number of cores in the box
@@ -771,8 +773,6 @@ static int cpu_autodetect()
 
 static void cpu_detect()
 {
-	RUNONCE();
-	
 	if ((opt_n_threads < 0 || !forced_n_threads)
 	 && ((total_devices || total_devices_new) && !opt_usecpu))
 		// If there are any other devices, only act if the user has explicitly enabled it

+ 2 - 2
driver-opencl.c

@@ -1411,6 +1411,8 @@ struct device_drv opencl_api;
 
 static int opencl_autodetect()
 {
+	RUNONCE(0);
+	
 #ifndef WIN32
 	if (!getenv("DISPLAY")) {
 		applog(LOG_DEBUG, "DISPLAY not set, setting :0 just in case");
@@ -1485,8 +1487,6 @@ static int opencl_autodetect()
 
 static void opencl_detect()
 {
-	RUNONCE();
-	
 	// This wrapper ensures users can specify -S opencl:noauto to disable it
 	noserial_detect(&opencl_api, opencl_autodetect);
 }