mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 22:23:33 +08:00
Replacing usleep with px4_usleep
This is a step towards isolating time from the system.
This commit is contained in:
@@ -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()) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -220,7 +220,7 @@ extern "C" {
|
||||
break;
|
||||
|
||||
} else {
|
||||
usleep(100000);
|
||||
px4_usleep(100000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user