Browse Source

convert sleep(const) to nmsleep()

nfactor-troky
Kano 12 years ago
parent
commit
6fb32f7b5d
  1. 2
      adl.c
  2. 4
      api.c
  3. 22
      cgminer.c
  4. 2
      driver-bitforce.c

2
adl.c

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

4
api.c

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

22
cgminer.c

@ -2502,7 +2502,7 @@ static bool submit_upstream_work(struct work *work, CURL *curl, bool resubmit)
pool->remotefail_occasions++; pool->remotefail_occasions++;
applog(LOG_WARNING, "Pool %d communication failure, caching submissions", pool->pool_no); applog(LOG_WARNING, "Pool %d communication failure, caching submissions", pool->pool_no);
} }
sleep(5); nmsleep(5000);
goto out; goto out;
} else if (pool_tclear(pool, &pool->submit_fail)) } else if (pool_tclear(pool, &pool->submit_fail))
applog(LOG_WARNING, "Pool %d communication resumed, submitting work", pool->pool_no); applog(LOG_WARNING, "Pool %d communication resumed, submitting work", pool->pool_no);
@ -2837,7 +2837,7 @@ static void __kill_work(void)
thr->pause = true; thr->pause = true;
} }
sleep(1); nmsleep(1000);
applog(LOG_DEBUG, "Killing off mining threads"); applog(LOG_DEBUG, "Killing off mining threads");
/* Kill the mining threads*/ /* Kill the mining threads*/
@ -4780,7 +4780,7 @@ static void *stratum_thread(void *userdata)
while (!initiate_stratum(pool) || !auth_stratum(pool)) { while (!initiate_stratum(pool) || !auth_stratum(pool)) {
if (pool->removed) if (pool->removed)
goto out; goto out;
sleep(30); nmsleep(30000);
} }
} }
} }
@ -4818,7 +4818,7 @@ static void *stratum_thread(void *userdata)
while (!initiate_stratum(pool) || !auth_stratum(pool)) { while (!initiate_stratum(pool) || !auth_stratum(pool)) {
if (pool->removed) if (pool->removed)
goto out; goto out;
sleep(30); nmsleep(30000);
} }
stratum_resumed(pool); stratum_resumed(pool);
continue; continue;
@ -5703,7 +5703,7 @@ retry_pool:
if (!pool) { if (!pool) {
applog(LOG_WARNING, "No suitable long-poll found for %s", cp->rpc_url); applog(LOG_WARNING, "No suitable long-poll found for %s", cp->rpc_url);
while (!pool) { while (!pool) {
sleep(60); nmsleep(60000);
pool = select_longpoll_pool(cp); pool = select_longpoll_pool(cp);
} }
} }
@ -5778,7 +5778,7 @@ retry_pool:
continue; continue;
if (failures == 1) if (failures == 1)
applog(LOG_WARNING, "longpoll failed for %s, retrying every 30s", lp_url); applog(LOG_WARNING, "longpoll failed for %s, retrying every 30s", lp_url);
sleep(30); nmsleep(30000);
} }
if (pool != cp) { if (pool != cp) {
@ -5883,7 +5883,7 @@ static void *watchpool_thread(void __maybe_unused *userdata)
switch_pools(NULL); switch_pools(NULL);
} }
sleep(30); nmsleep(30000);
} }
return NULL; return NULL;
@ -6566,7 +6566,7 @@ static void *hotplug_thread(void __maybe_unused *userdata)
hotplug_mode = true; hotplug_mode = true;
while (0x2a) { while (0x2a) {
sleep(5); nmsleep(5000);
// Version 0.1 just add the devices on - worry about using nodev later // 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) { while (!pool->stratum_active || !pool->stratum_notify) {
struct pool *altpool = select_pool(true); struct pool *altpool = select_pool(true);
sleep(5); nmsleep(5000);
if (altpool != pool) { if (altpool != pool) {
pool = altpool; pool = altpool;
goto retry; goto retry;
@ -7186,7 +7186,7 @@ retry:
while (pool->idle) { while (pool->idle) {
struct pool *altpool = select_pool(true); struct pool *altpool = select_pool(true);
sleep(5); nmsleep(5000);
if (altpool != pool) { if (altpool != pool) {
pool = altpool; pool = altpool;
goto retry; goto retry;
@ -7220,7 +7220,7 @@ retry:
* requests but is up as we'll keep hammering it */ * requests but is up as we'll keep hammering it */
if (++pool->seq_getfails > mining_threads + opt_queue) if (++pool->seq_getfails > mining_threads + opt_queue)
pool_died(pool); pool_died(pool);
sleep(5); nmsleep(5000);
push_curl_entry(ce, pool); push_curl_entry(ce, pool);
pool = select_pool(!opt_fail_only); pool = select_pool(!opt_fail_only);
goto retry; goto retry;

2
driver-bitforce.c

@ -343,7 +343,7 @@ static void bitforce_flash_led(struct cgpu_info *bitforce)
} else { } else {
/* However, this stops anything else getting a reply /* However, this stops anything else getting a reply
* So best to delay any other access to the BFL */ * 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 */ /* Once we've tried - don't do it until told to again */

Loading…
Cancel
Save