summaryrefslogtreecommitdiff
path: root/udev/udevd.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2010-04-26 12:21:16 +0200
committerKay Sievers <kay.sievers@vrfy.org>2010-04-26 12:25:59 +0200
commit665ee17def2caa6811ae032ae68ebf8239a18cf8 (patch)
treec55a8d33011173043f5d00090b23327937e4501d /udev/udevd.c
parentad3d4198439f06cab8a2a65190ad501b803666a1 (diff)
udevd: always try to find an idle worker instead of forking a new one
We special-handle events with a TIMEOUT= set, so they don't get queued or wait for parent events to finish, to make sure we can handle them as fast as possible. With this change we first try to find an idle worker process before forking a new one.
Diffstat (limited to 'udev/udevd.c')
-rw-r--r--udev/udevd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/udev/udevd.c b/udev/udevd.c
index c27b4cd6aa..7712543734 100644
--- a/udev/udevd.c
+++ b/udev/udevd.c
@@ -360,7 +360,7 @@ static void worker_new(struct event *event)
}
}
-static void event_run(struct event *event)
+static void event_run(struct event *event, bool force)
{
struct udev_list_node *loop;
@@ -385,7 +385,7 @@ static void event_run(struct event *event)
return;
}
- if (childs >= max_childs) {
+ if (!force && childs >= max_childs) {
info(event->udev, "maximum number (%i) of childs reached\n", childs);
return;
}
@@ -420,7 +420,7 @@ static void event_queue_insert(struct udev_device *dev)
/* run all events with a timeout set immediately */
if (udev_device_get_timeout(dev) > 0) {
- worker_new(event);
+ event_run(event, true);
return;
}
}
@@ -552,7 +552,7 @@ static void events_start(struct udev *udev)
continue;
}
- event_run(event);
+ event_run(event, false);
}
}