Rationale: No hotpluggable CPU & GPU support, and no claim/conflict detection
@@ -33,6 +33,7 @@
#include "fpgautils.h"
#include "miner.h"
#include "bench_block.h"
+#include "util.h"
#include "driver-cpu.h"
#if defined(unix)
@@ -770,6 +771,8 @@ 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
@@ -1485,6 +1485,8 @@ static int opencl_autodetect()
static void opencl_detect()
// This wrapper ensures users can specify -S opencl:noauto to disable it
noserial_detect(&opencl_api, opencl_autodetect);
}
@@ -189,4 +189,12 @@ struct timeval *select_timeout(struct timeval *tvp_timeout, struct timeval *tvp_
+#define RUNONCE(rv) do { \
+ static bool _runonce = false; \
+ if (_runonce) \
+ return rv; \
+ _runonce = true; \
+} while(0)
#endif /* __UTIL_H__ */