diff options
author | Thomas Haller <thaller@redhat.com> | 2020-08-10 17:30:59 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2020-09-03 11:39:39 +0200 |
commit | 265a5879aee9735de378c8440cd5b0b229643cc3 (patch) | |
tree | bd3b265e7a534007d1e961670000b4c5fbfc2bd2 | |
parent | fc66ad70d52a81695e5c1b932005301bccf9afa5 (diff) | |
download | NetworkManager-265a5879aee9735de378c8440cd5b0b229643cc3.tar.gz |
shared: add nm_g_timeout_source_new_seconds()
-rw-r--r-- | shared/nm-glib-aux/nm-shared-utils.c | 16 | ||||
-rw-r--r-- | shared/nm-glib-aux/nm-shared-utils.h | 7 |
2 files changed, 23 insertions, 0 deletions
diff --git a/shared/nm-glib-aux/nm-shared-utils.c b/shared/nm-glib-aux/nm-shared-utils.c index 03f31967c9..21fb72dfb3 100644 --- a/shared/nm-glib-aux/nm-shared-utils.c +++ b/shared/nm-glib-aux/nm-shared-utils.c @@ -4521,6 +4521,22 @@ nm_g_timeout_source_new (guint timeout_msec, } GSource * +nm_g_timeout_source_new_seconds (guint timeout_sec, + int priority, + GSourceFunc func, + gpointer user_data, + GDestroyNotify destroy_notify) +{ + GSource *source; + + source = g_timeout_source_new_seconds (timeout_sec); + if (priority != G_PRIORITY_DEFAULT) + g_source_set_priority (source, priority); + g_source_set_callback (source, func, user_data, destroy_notify); + return source; +} + +GSource * nm_g_unix_signal_source_new (int signum, int priority, GSourceFunc handler, diff --git a/shared/nm-glib-aux/nm-shared-utils.h b/shared/nm-glib-aux/nm-shared-utils.h index b31c4779da..1ff5897399 100644 --- a/shared/nm-glib-aux/nm-shared-utils.h +++ b/shared/nm-glib-aux/nm-shared-utils.h @@ -1349,6 +1349,13 @@ GSource *nm_g_timeout_source_new (guint timeout_msec, GSourceFunc func, gpointer user_data, GDestroyNotify destroy_notify); + +GSource *nm_g_timeout_source_new_seconds (guint timeout_sec, + int priority, + GSourceFunc func, + gpointer user_data, + GDestroyNotify destroy_notify); + GSource *nm_g_unix_fd_source_new (int fd, GIOCondition io_condition, int priority, |