Browse Source

convert sleep(const) to nmsleep()

Conflicts:
	driver-bitforce.c
	miner.c
Kano 13 years ago
parent
commit
494b09e91c
7 changed files with 16 additions and 16 deletions
  1. 1 1
      adl.c
  2. 2 2
      api.c
  3. 2 2
      driver-avalon.c
  4. 2 2
      driver-bitforce.c
  5. 1 1
      driver-cairnsmore.c
  6. 1 1
      driver-x6500.c
  7. 7 7
      miner.c

+ 1 - 1
adl.c

@@ -1375,7 +1375,7 @@ updated:
 		clear_logwin();
 		return;
 	}
-	sleep(1);
+	nmsleep(1000);
 	goto updated;
 }
 #endif

+ 2 - 2
api.c

@@ -3599,7 +3599,7 @@ void api(int api_thr_id)
 
 	/* This should be done before curl in needed
 	 * to ensure curl has already called WSAStartup() in windows */
-	sleep(opt_log_interval);
+	nmsleep(opt_log_interval*1000);
 
 	sock = socket(AF_INET, SOCK_STREAM, 0);
 	if (sock == INVSOCK) {
@@ -3645,7 +3645,7 @@ void api(int api_thr_id)
 				break;
 			else {
 				applog(LOG_WARNING, "API bind to port %d failed - trying again in 30sec", port);
-				sleep(30);
+				nmsleep(30000);
 			}
 		} else
 			bound = 1;

+ 2 - 2
driver-avalon.c

@@ -678,7 +678,7 @@ static void do_avalon_close(struct thr_info *thr)
 	struct cgpu_info *avalon = thr->cgpu;
 	struct avalon_info *info = avalon_info[avalon->device_id];
 
-	sleep(1);
+	nmsleep(1000);
 	avalon_reset(avalon->device_fd, &ar);
 	avalon_idle(avalon);
 	avalon_close(avalon->device_fd);
@@ -817,7 +817,7 @@ static int64_t avalon_scanhash(struct thr_info *thr, struct work **work,
 			       avalon->device_id);
 			dev_error(avalon, REASON_DEV_COMMS_ERROR);
 			first_try = 0;
-			sleep(1);
+			nmsleep(1000);
 			return 0;	/* This should never happen */
 		}
 		if (ret == AVA_SEND_BUFFER_EMPTY && (i + 1 == avalon_get_work_count)) {

+ 2 - 2
driver-bitforce.c

@@ -335,7 +335,7 @@ void bitforce_reinit(struct cgpu_info *bitforce)
 
 	if (fdDev) {
 		BFclose(fdDev);
-		sleep(5);
+		nmsleep(5000);
 		*p_fdDev = 0;
 	}
 
@@ -432,7 +432,7 @@ static void bitforce_flash_led(struct cgpu_info *bitforce)
 
 	/* However, this stops anything else getting a reply
 	 * So best to delay any other access to the BFL */
-	sleep(4);
+	nmsleep(4000);
 
 	mutex_unlock(mutexp);
 

+ 1 - 1
driver-cairnsmore.c

@@ -190,7 +190,7 @@ static bool cairnsmore_identify(struct cgpu_info *cm1)
 		return false;
 	
 	cairnsmore_send_cmd(cm1->device_fd, 1, 1);
-	sleep(5);
+	nmsleep(5000);
 	cairnsmore_send_cmd(cm1->device_fd, 1, 0);
 	cm1->flash_led = true;
 	return true;

+ 1 - 1
driver-x6500.c

@@ -251,7 +251,7 @@ x6500_fpga_upload_bitstream(struct cgpu_info *x6500, struct jtag_port *jp1)
 	x6500_jtag_set(jp, 0x11);
 	jtag_write(jp, JTAG_REG_IR, "\xa0", 6);  // CFG_IN
 	
-	sleep(1);
+	nmsleep(1000);
 	
 	if (fread(buf, 32, 1, f) != 1)
 		bailout2(LOG_ERR, "%s: File underrun programming %s (%lu bytes left)", x6500->dev_repr, x6500->device_path, len);

+ 7 - 7
miner.c

@@ -3412,7 +3412,7 @@ static void __kill_work(void)
 		thr->pause = true;
 	}
 
-	sleep(1);
+	nmsleep(1000);
 
 	applog(LOG_DEBUG, "Killing off mining threads");
 	/* Kill the mining threads*/
@@ -6113,7 +6113,7 @@ static void *stratum_thread(void *userdata)
 				while (!restart_stratum(pool)) {
 					if (pool->removed)
 						goto out;
-					sleep(30);
+					nmsleep(30000);
 				}
 			}
 		}
@@ -7025,7 +7025,7 @@ retry_pool:
 	if (!pool) {
 		applog(LOG_WARNING, "No suitable long-poll found for %s", cp->rpc_url);
 		while (!pool) {
-			sleep(60);
+			nmsleep(60000);
 			pool = select_longpoll_pool(cp);
 		}
 	}
@@ -7102,7 +7102,7 @@ retry_pool:
 			if (failures == 1)
 				applog(LOG_WARNING, "longpoll failed for %s, retrying every 30s", lp_url);
 lpfail:
-			sleep(30);
+			nmsleep(30000);
 		}
 
 		if (pool != cp) {
@@ -7245,7 +7245,7 @@ static void *watchpool_thread(void __maybe_unused *userdata)
 			switch_pools(NULL);
 		}
 
-		sleep(30);
+		nmsleep(30000);
 			
 	}
 	return NULL;
@@ -8582,7 +8582,7 @@ retry:
 				struct pool *altpool = select_pool(true);
 
 				if (altpool == pool && pool->has_stratum)
-					sleep(5);
+					nmsleep(5000);
 				pool = altpool;
 				goto retry;
 			}
@@ -8641,7 +8641,7 @@ retry:
 			next_pool = select_pool(!opt_fail_only);
 			if (pool == next_pool) {
 				applog(LOG_DEBUG, "Pool %d json_rpc_call failed on get work, retrying in 5s", pool->pool_no);
-				sleep(5);
+				nmsleep(5000);
 			} else {
 				applog(LOG_DEBUG, "Pool %d json_rpc_call failed on get work, failover activated", pool->pool_no);
 				pool = next_pool;