diff options
| author | Sebastien Bacher <seb128@ubuntu.com> | 2020-05-19 16:38:36 +0200 |
|---|---|---|
| committer | Sebastien Bacher <seb128@ubuntu.com> | 2020-05-19 17:09:07 +0200 |
| commit | ccf6dc06bbee82c3d49f451545c5317337e0777e (patch) | |
| tree | a8fddc8c6e2b3b99bebab1d5bb2a64581eff4bfd /shared/nm-udev-aux/nm-udev-utils.c | |
| parent | f109e55ef130ce84054d5ba3acf4b71cd8c7564a (diff) | |
| parent | 7ffed1e6136de75188f10ba8763bcb942f932f8e (diff) | |
Merge remote-tracking branch 'salsa/debian/master' into ubuntu/master
Diffstat (limited to 'shared/nm-udev-aux/nm-udev-utils.c')
| -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; |