summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2016-08-15 22:25:56 -0700
committerPeter Hutterer <peter.hutterer@who-t.net>2016-08-16 17:33:59 +1000
commitbf2ca502b9cd07044cba56499d5c092deb9d73f5 (patch)
tree866d3612522bac2afba3ed2eae52bfbab7cb529b /config
parentde5291c04b05772e6da599a475baa1b19dcae07a (diff)
config: Hold input lock across udev socket handling
This avoids having the server running inside libudev from two threads at once, which it appears to not like. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'config')
-rw-r--r--config/udev.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/config/udev.c b/config/udev.c
index 23b795f64..932f230c7 100644
--- a/config/udev.c
+++ b/config/udev.c
@@ -345,9 +345,12 @@ socket_handler(int fd, int ready, void *data)
struct udev_device *udev_device;
const char *action;
+ input_lock();
udev_device = udev_monitor_receive_device(udev_monitor);
- if (!udev_device)
+ if (!udev_device) {
+ input_unlock();
return;
+ }
action = udev_device_get_action(udev_device);
if (action) {
if (!strcmp(action, "add")) {
@@ -364,6 +367,7 @@ socket_handler(int fd, int ready, void *data)
device_removed(udev_device);
}
udev_device_unref(udev_device);
+ input_unlock();
}
int