summaryrefslogtreecommitdiff
path: root/src/NetworkManagerUtils.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/NetworkManagerUtils.h')
-rw-r--r--src/NetworkManagerUtils.h34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/NetworkManagerUtils.h b/src/NetworkManagerUtils.h
index e957b95e29..72be1c4cf6 100644
--- a/src/NetworkManagerUtils.h
+++ b/src/NetworkManagerUtils.h
@@ -74,13 +74,43 @@ NMPlatformRoutingRule *nm_ip_routing_rule_to_platform (const NMIPRoutingRule *ru
#define NM_SHUTDOWN_TIMEOUT_MS 1500
#define NM_SHUTDOWN_TIMEOUT_MS_WATCHDOG 500
+typedef enum {
+ /* The watched_obj argument is a GObject, and shutdown is delayed until the object
+ * gets destroyed (or unregistered). */
+ NM_SHUTDOWN_WAIT_TYPE_OBJECT,
+
+ /* The watched_obj argument is a GCancellable, and shutdown is delayed until the object
+ * gets destroyed (or unregistered). Note that after NM_SHUTDOWN_TIMEOUT_MS, the
+ * cancellable will be cancelled to notify listeners about the shutdown. */
+ NM_SHUTDOWN_WAIT_TYPE_CANCELLABLE,
+} NMShutdownWaitType;
+
typedef struct _NMShutdownWaitObjHandle NMShutdownWaitObjHandle;
-NMShutdownWaitObjHandle *nm_shutdown_wait_obj_register_full (GObject *watched_obj,
+NMShutdownWaitObjHandle *nm_shutdown_wait_obj_register_full (gpointer watched_obj,
+ NMShutdownWaitType wait_type,
char *msg_reason,
gboolean free_msg_reason);
-#define nm_shutdown_wait_obj_register(watched_obj, msg_reason) nm_shutdown_wait_obj_register_full((watched_obj), (""msg_reason""), FALSE)
+static inline NMShutdownWaitObjHandle *
+nm_shutdown_wait_obj_register_object_full (gpointer watched_obj,
+ char *msg_reason,
+ gboolean free_msg_reason)
+{
+ return nm_shutdown_wait_obj_register_full (watched_obj, NM_SHUTDOWN_WAIT_TYPE_OBJECT, msg_reason, free_msg_reason);
+}
+
+#define nm_shutdown_wait_obj_register_object(watched_obj, msg_reason) nm_shutdown_wait_obj_register_object_full((watched_obj), (""msg_reason""), FALSE)
+
+static inline NMShutdownWaitObjHandle *
+nm_shutdown_wait_obj_register_cancellable_full (GCancellable *watched_obj,
+ char *msg_reason,
+ gboolean free_msg_reason)
+{
+ return nm_shutdown_wait_obj_register_full (watched_obj, NM_SHUTDOWN_WAIT_TYPE_CANCELLABLE, msg_reason, free_msg_reason);
+}
+
+#define nm_shutdown_wait_obj_register_cancellable(watched_obj, msg_reason) nm_shutdown_wait_obj_register_cancellable_full((watched_obj), (""msg_reason""), FALSE)
void nm_shutdown_wait_obj_unregister (NMShutdownWaitObjHandle *handle);