diff options
author | Tom Gundersen <teg@jklm.no> | 2015-05-18 17:06:00 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2015-05-29 18:52:13 +0200 |
commit | 8302fe5a132ab0b6af21aad051b91b7e655e200b (patch) | |
tree | b9c6ac745087d52b1529c0decce3a56624ddfa70 /src/udev | |
parent | 7c4c7e891364660597c2511c44c7bfccb6a5b124 (diff) |
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.
Diffstat (limited to 'src/udev')
-rw-r--r-- | src/udev/udevd.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 300b8de89a..b9c7034794 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -847,6 +847,9 @@ static int on_worker(sd_event_source *s, int fd, uint32_t revents, void *userdat event_free(worker->event); } + /* we have free workers, try to schedule events */ + event_queue_start(manager); + 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); if (r < 0) udev_device_unref(dev); + else + /* we have fresh events, try to schedule them */ + event_queue_start(manager); } 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) { log_debug("udevd message (START_EXEC_QUEUE) received"); manager->stop_exec_queue = false; + event_queue_start(manager); } 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); } + /* we can start new workers, try to schedule events */ + event_queue_start(manager); + return 1; } @@ -1681,9 +1691,6 @@ int main(int argc, char *argv[]) { if (is_uevent) on_uevent(NULL, manager->fd_uevent, 0, manager); - /* start new events */ - event_queue_start(manager); - if (is_signal) { struct signalfd_siginfo fdsi; ssize_t size; |