Browse Source

Merge commit '363ead9' into bfgminer

Luke Dashjr 11 years ago
parent
commit
db23ffa2eb
2 changed files with 14 additions and 11 deletions
  1. 9 5
      api.c
  2. 5 6
      miner.c

+ 9 - 5
api.c

@@ -1826,7 +1826,8 @@ static void cpudev(struct io_data *io_data, __maybe_unused SOCKETTYPE c, char *p
 	bool io_open = false;
 	int id;
 
-	if (opt_n_threads == 0) {
+	if (opt_n_threads <= 0)
+	{
 		message(io_data, MSG_CPUNON, 0, NULL, isjson);
 		return;
 	}
@@ -1976,7 +1977,7 @@ static void summary(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __mayb
 
 	root = api_add_elapsed(root, "Elapsed", &(total_secs), true);
 #ifdef WANT_CPUMINE
-	if (opt_n_threads)
+	if (opt_n_threads > 0)
 	root = api_add_string(root, "Algorithm", algo, false);
 #endif
 	root = api_add_mhs(root, "MHS av", &(mhs), false);
@@ -2171,7 +2172,8 @@ static void cpuenable(struct io_data *io_data, __maybe_unused SOCKETTYPE c, char
 {
 	int id;
 
-	if (opt_n_threads == 0) {
+	if (opt_n_threads <= 0)
+	{
 		message(io_data, MSG_CPUNON, 0, NULL, isjson);
 		return;
 	}
@@ -2209,7 +2211,8 @@ static void cpudisable(struct io_data *io_data, __maybe_unused SOCKETTYPE c, cha
 {
 	int id;
 
-	if (opt_n_threads == 0) {
+	if (opt_n_threads <= 0)
+	{
 		message(io_data, MSG_CPUNON, 0, NULL, isjson);
 		return;
 	}
@@ -2242,7 +2245,8 @@ static void cpurestart(struct io_data *io_data, __maybe_unused SOCKETTYPE c, cha
 {
 	int id;
 
-	if (opt_n_threads == 0) {
+	if (opt_n_threads <= 0)
+	{
 		message(io_data, MSG_CPUNON, 0, NULL, isjson);
 		return;
 	}

+ 5 - 6
miner.c

@@ -10213,7 +10213,7 @@ void print_summary(void)
 	if (total_pools == 1)
 		applog(LOG_WARNING, "Pool: %s", pools[0]->rpc_url);
 #ifdef WANT_CPUMINE
-	if (opt_n_threads)
+	if (opt_n_threads > 0)
 		applog(LOG_WARNING, "CPU hasher algorithm used: %s", algo_names[opt_algo]);
 #endif
 	applog(LOG_WARNING, "Runtime: %d hrs : %d mins : %d secs", hours, mins, secs);
@@ -10332,7 +10332,7 @@ void _bfg_clean_up(bool restarting)
 			print_summary();
 	}
 
-	if (opt_n_threads)
+	if (opt_n_threads > 0)
 		free(cpus);
 
 	curl_global_cleanup();
@@ -11976,10 +11976,9 @@ begin_bench:
 #endif
 
 #ifdef WANT_CPUMINE
-	applog(LOG_INFO, "%d cpu miner threads started, "
-		"using SHA256 '%s' algorithm.",
-		opt_n_threads,
-		algo_names[opt_algo]);
+	if (opt_n_threads > 0)
+		applog(LOG_INFO, "%d cpu miner threads started, using '%s' algorithm.",
+		       opt_n_threads, algo_names[opt_algo]);
 #endif
 
 	cgtime(&total_tv_start);