Merge pull request #27843 from yuwata/usleep_safe
time-util: introduce usleep_safe()
This commit is contained in:
@@ -750,7 +750,7 @@ static int open_drive(Context *c) {
|
||||
if (++cnt >= 20 || errno != EBUSY)
|
||||
return log_debug_errno(errno, "Unable to open '%s': %m", arg_node);
|
||||
|
||||
(void) usleep(100 * USEC_PER_MSEC + random_u64_range(100 * USEC_PER_MSEC));
|
||||
(void) usleep_safe(100 * USEC_PER_MSEC + random_u64_range(100 * USEC_PER_MSEC));
|
||||
}
|
||||
|
||||
log_debug("probing: '%s'", arg_node);
|
||||
|
||||
@@ -1223,7 +1223,7 @@ void udev_event_execute_run(UdevEvent *event, usec_t timeout_usec, int timeout_s
|
||||
if (event->exec_delay_usec > 0) {
|
||||
log_device_debug(event->dev, "Delaying execution of \"%s\" for %s.",
|
||||
command, FORMAT_TIMESPAN(event->exec_delay_usec, USEC_PER_SEC));
|
||||
(void) usleep(event->exec_delay_usec);
|
||||
(void) usleep_safe(event->exec_delay_usec);
|
||||
}
|
||||
|
||||
log_device_debug(event->dev, "Running command \"%s\"", command);
|
||||
|
||||
Reference in New Issue
Block a user