treewide: Replace usleep with nanosleep
usleep was removed in POSIX 2008 and is optionally unavailable with uClibc-ng. Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
089684e20f
commit
ffff5d6646
|
|
@ -660,12 +660,13 @@ int main(int argc, char **argv) {
|
||||||
if (Modes.sdr_type == SDR_NONE) {
|
if (Modes.sdr_type == SDR_NONE) {
|
||||||
while (!Modes.exit) {
|
while (!Modes.exit) {
|
||||||
struct timespec start_time;
|
struct timespec start_time;
|
||||||
|
struct timespec slp = { 0, 100 * 1000 * 1000};
|
||||||
|
|
||||||
start_cpu_timing(&start_time);
|
start_cpu_timing(&start_time);
|
||||||
backgroundTasks();
|
backgroundTasks();
|
||||||
end_cpu_timing(&start_time, &Modes.stats_current.background_cpu);
|
end_cpu_timing(&start_time, &Modes.stats_current.background_cpu);
|
||||||
|
|
||||||
usleep(100000);
|
nanosleep(&slp, NULL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int watchdogCounter = 10; // about 1 second
|
int watchdogCounter = 10; // about 1 second
|
||||||
|
|
|
||||||
|
|
@ -207,8 +207,9 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
// Run it until we've lost either connection
|
// Run it until we've lost either connection
|
||||||
while (!Modes.exit && beast_input->connections && fatsv_output->connections) {
|
while (!Modes.exit && beast_input->connections && fatsv_output->connections) {
|
||||||
|
struct timespec r = { 0, 100 * 1000 * 1000};
|
||||||
backgroundTasks();
|
backgroundTasks();
|
||||||
usleep(100000);
|
nanosleep(&r, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -212,6 +212,7 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
// Keep going till the user does something that stops us
|
// Keep going till the user does something that stops us
|
||||||
while (!Modes.exit) {
|
while (!Modes.exit) {
|
||||||
|
struct timespec r = { 0, 100 * 1000 * 1000};
|
||||||
icaoFilterExpire();
|
icaoFilterExpire();
|
||||||
trackPeriodicUpdate();
|
trackPeriodicUpdate();
|
||||||
modesNetPeriodicWork();
|
modesNetPeriodicWork();
|
||||||
|
|
@ -221,12 +222,12 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
if (s->connections == 0) {
|
if (s->connections == 0) {
|
||||||
// lost input connection, try to reconnect
|
// lost input connection, try to reconnect
|
||||||
usleep(1000000);
|
sleep(1);
|
||||||
c = serviceConnect(s, bo_connect_ipaddr, bo_connect_port);
|
c = serviceConnect(s, bo_connect_ipaddr, bo_connect_port);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
usleep(100000);
|
nanosleep(&r, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
interactiveCleanup();
|
interactiveCleanup();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue