mirror of
https://github.com/systemd/systemd.git
synced 2024-11-05 23:51:28 +03:00
udevd: explicitly try to start event queue when it may be possible
Rather than trying to schedule new events on every main-loop iteration, do it explicitly when processing an event finishes, a worker is killed, a new uevent is received, or the event queue is explicitly restarted.
This commit is contained in:
parent
7c4c7e8913
commit
8302fe5a13
@ -847,6 +847,9 @@ static int on_worker(sd_event_source *s, int fd, uint32_t revents, void *userdat
|
|||||||
event_free(worker->event);
|
event_free(worker->event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* we have free workers, try to schedule events */
|
||||||
|
event_queue_start(manager);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -863,6 +866,9 @@ static int on_uevent(sd_event_source *s, int fd, uint32_t revents, void *userdat
|
|||||||
r = event_queue_insert(manager, dev);
|
r = event_queue_insert(manager, dev);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
udev_device_unref(dev);
|
udev_device_unref(dev);
|
||||||
|
else
|
||||||
|
/* we have fresh events, try to schedule them */
|
||||||
|
event_queue_start(manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -901,6 +907,7 @@ static int on_ctrl_msg(sd_event_source *s, int fd, uint32_t revents, void *userd
|
|||||||
if (udev_ctrl_get_start_exec_queue(ctrl_msg) > 0) {
|
if (udev_ctrl_get_start_exec_queue(ctrl_msg) > 0) {
|
||||||
log_debug("udevd message (START_EXEC_QUEUE) received");
|
log_debug("udevd message (START_EXEC_QUEUE) received");
|
||||||
manager->stop_exec_queue = false;
|
manager->stop_exec_queue = false;
|
||||||
|
event_queue_start(manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (udev_ctrl_get_reload(ctrl_msg) > 0) {
|
if (udev_ctrl_get_reload(ctrl_msg) > 0) {
|
||||||
@ -1167,6 +1174,9 @@ static int on_sigchld(sd_event_source *s, const struct signalfd_siginfo *si, voi
|
|||||||
worker_free(worker);
|
worker_free(worker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* we can start new workers, try to schedule events */
|
||||||
|
event_queue_start(manager);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1681,9 +1691,6 @@ int main(int argc, char *argv[]) {
|
|||||||
if (is_uevent)
|
if (is_uevent)
|
||||||
on_uevent(NULL, manager->fd_uevent, 0, manager);
|
on_uevent(NULL, manager->fd_uevent, 0, manager);
|
||||||
|
|
||||||
/* start new events */
|
|
||||||
event_queue_start(manager);
|
|
||||||
|
|
||||||
if (is_signal) {
|
if (is_signal) {
|
||||||
struct signalfd_siginfo fdsi;
|
struct signalfd_siginfo fdsi;
|
||||||
ssize_t size;
|
ssize_t size;
|
||||||
|
Loading…
Reference in New Issue
Block a user