diff options
| author | Michael Biebl <biebl@debian.org> | 2020-04-11 21:28:04 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2020-04-11 21:28:04 +0200 |
| commit | 1e5977b62f896e844b548c3007ace9e1dfa7f9ed (patch) | |
| tree | 7a7416ed410e72b6200f3d860fd315ec11cc106b /shared/nm-udev-aux | |
| parent | b012fa6e1d808e0736c009799c62d835cbfcc1dd (diff) | |
New upstream version 1.23.90 upstream/1.23.90
Diffstat (limited to 'shared/nm-udev-aux')
| -rw-r--r-- | shared/nm-udev-aux/nm-udev-utils.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/shared/nm-udev-aux/nm-udev-utils.c b/shared/nm-udev-aux/nm-udev-utils.c index 1b0927df..c00dcd33 100644 --- a/shared/nm-udev-aux/nm-udev-utils.c +++ b/shared/nm-udev-aux/nm-udev-utils.c @@ -164,7 +164,7 @@ nm_udev_client_enumerate_new (NMUdevClient *self) /*****************************************************************************/ static gboolean -monitor_event (GIOChannel *source, +monitor_event (int fd, GIOCondition condition, gpointer user_data) { @@ -204,7 +204,6 @@ nm_udev_client_new (const char *const*subsystems, gpointer event_user_data) { NMUdevClient *self; - GIOChannel *channel; guint n; self = g_slice_new0 (NMUdevClient); @@ -237,12 +236,14 @@ nm_udev_client_new (const char *const*subsystems, /* listen to events, and buffer them */ udev_monitor_set_receive_buffer_size (self->monitor, 4*1024*1024); udev_monitor_enable_receiving (self->monitor); - channel = g_io_channel_unix_new (udev_monitor_get_fd (self->monitor)); - self->watch_source = g_io_create_watch (channel, G_IO_IN); - g_io_channel_unref (channel); - g_source_set_callback (self->watch_source, (GSourceFunc)(void (*) (void)) monitor_event, self, NULL); + + self->watch_source = nm_g_unix_fd_source_new (udev_monitor_get_fd (self->monitor), + G_IO_IN, + G_PRIORITY_DEFAULT, + monitor_event, + self, + NULL); g_source_attach (self->watch_source, g_main_context_get_thread_default ()); - g_source_unref (self->watch_source); } } @@ -258,10 +259,7 @@ nm_udev_client_unref (NMUdevClient *self) if (!self) return NULL; - if (self->watch_source) { - g_source_destroy (self->watch_source); - self->watch_source = NULL; - } + nm_clear_g_source_inst (&self->watch_source); udev_monitor_unref (self->monitor); self->monitor = NULL; |