Replacing usleep with px4_usleep

This is a step towards isolating time from the system.
This commit is contained in:
Julian Oes
2018-12-22 10:32:18 +01:00
parent e485885344
commit 5b9dea5604
112 changed files with 339 additions and 305 deletions
@@ -271,7 +271,7 @@ AirspeedSim::read(cdev::file_t *filp, char *buffer, size_t buflen)
}
/* wait for it to complete */
usleep(_conversion_interval);
px4_usleep(_conversion_interval);
/* run the collection phase */
if (OK != collect()) {
+3 -3
View File
@@ -198,7 +198,7 @@ GPSSIM::~GPSSIM()
/* spin waiting for the task to stop */
for (unsigned i = 0; (i < 10) && (_task != -1); i++) {
/* give it another 100ms */
usleep(100000);
px4_usleep(100000);
}
/* well, kill it anyway, though this will probably crash */
@@ -301,7 +301,7 @@ GPSSIM::receive(int timeout)
} else {
usleep(timeout);
px4_usleep(timeout);
return 0;
}
}
@@ -371,7 +371,7 @@ GPSSIM::print_info()
print_message(_report_gps_pos);
}
usleep(100000);
px4_usleep(100000);
}
void
+1 -1
View File
@@ -220,7 +220,7 @@ extern "C" {
break;
} else {
usleep(100000);
px4_usleep(100000);
}
}
+2 -2
View File
@@ -336,7 +336,7 @@ void Simulator::handle_message(mavlink_message_t *msg, bool publish)
unsigned usleep_delay = (sysdelay - min_delay) / _realtime_factor;
// extend by the realtime factor to avoid drift
usleep(usleep_delay);
px4_usleep(usleep_delay);
hrt_stop_delay_delta(exact_delay);
px4_sim_stop_delay();
}
@@ -838,7 +838,7 @@ void Simulator::pollForMAVLinkMessages(bool publish, int udp_port)
if (pret < 0) {
PX4_WARN("simulator mavlink: poll error %d, %d", pret, errno);
// sleep a bit before next try
usleep(100000);
px4_usleep(100000);
continue;
}