convert sleep(const) to nmsleep()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
diff --git a/adl.c b/adl.c
index d5e83a9..3ff7e02 100644
--- a/adl.c
+++ b/adl.c
@@ -1392,7 +1392,7 @@ updated:
clear_logwin();
return;
}
- sleep(1);
+ nmsleep(1000);
goto updated;
}
#endif
diff --git a/api.c b/api.c
index 776e735..6d77c60 100644
--- a/api.c
+++ b/api.c
@@ -3792,7 +3792,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) {
@@ -3838,7 +3838,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;
diff --git a/cgminer.c b/cgminer.c
index 33d4341..7b17950 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -2502,7 +2502,7 @@ static bool submit_upstream_work(struct work *work, CURL *curl, bool resubmit)
pool->remotefail_occasions++;
applog(LOG_WARNING, "Pool %d communication failure, caching submissions", pool->pool_no);
}
- sleep(5);
+ nmsleep(5000);
goto out;
} else if (pool_tclear(pool, &pool->submit_fail))
applog(LOG_WARNING, "Pool %d communication resumed, submitting work", pool->pool_no);
@@ -2837,7 +2837,7 @@ static void __kill_work(void)
thr->pause = true;
}
- sleep(1);
+ nmsleep(1000);
applog(LOG_DEBUG, "Killing off mining threads");
/* Kill the mining threads*/
@@ -4780,7 +4780,7 @@ static void *stratum_thread(void *userdata)
while (!initiate_stratum(pool) || !auth_stratum(pool)) {
if (pool->removed)
goto out;
- sleep(30);
+ nmsleep(30000);
}
}
}
@@ -4818,7 +4818,7 @@ static void *stratum_thread(void *userdata)
while (!initiate_stratum(pool) || !auth_stratum(pool)) {
if (pool->removed)
goto out;
- sleep(30);
+ nmsleep(30000);
}
stratum_resumed(pool);
continue;
@@ -5703,7 +5703,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);
}
}
@@ -5778,7 +5778,7 @@ retry_pool:
continue;
if (failures == 1)
applog(LOG_WARNING, "longpoll failed for %s, retrying every 30s", lp_url);
- sleep(30);
+ nmsleep(30000);
}
if (pool != cp) {
@@ -5883,7 +5883,7 @@ static void *watchpool_thread(void __maybe_unused *userdata)
switch_pools(NULL);
}
- sleep(30);
+ nmsleep(30000);
}
return NULL;
@@ -6566,7 +6566,7 @@ static void *hotplug_thread(void __maybe_unused *userdata)
hotplug_mode = true;
while (0x2a) {
- sleep(5);
+ nmsleep(5000);
// Version 0.1 just add the devices on - worry about using nodev later
@@ -7170,7 +7170,7 @@ retry:
while (!pool->stratum_active || !pool->stratum_notify) {
struct pool *altpool = select_pool(true);
- sleep(5);
+ nmsleep(5000);
if (altpool != pool) {
pool = altpool;
goto retry;
@@ -7186,7 +7186,7 @@ retry:
while (pool->idle) {
struct pool *altpool = select_pool(true);
- sleep(5);
+ nmsleep(5000);
if (altpool != pool) {
pool = altpool;
goto retry;
@@ -7220,7 +7220,7 @@ retry:
* requests but is up as we'll keep hammering it */
if (++pool->seq_getfails > mining_threads + opt_queue)
pool_died(pool);
- sleep(5);
+ nmsleep(5000);
push_curl_entry(ce, pool);
pool = select_pool(!opt_fail_only);
goto retry;
diff --git a/driver-bitforce.c b/driver-bitforce.c
index de1a8e6..b7f238b 100644
--- a/driver-bitforce.c
+++ b/driver-bitforce.c
@@ -343,7 +343,7 @@ static void bitforce_flash_led(struct cgpu_info *bitforce)
} else {
/* However, this stops anything else getting a reply
* So best to delay any other access to the BFL */
- sleep(4);
+ nmsleep(4000);
}
/* Once we've tried - don't do it until told to again */