diff options
author | Thomas Haller <thaller@redhat.com> | 2019-09-02 15:54:31 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-09-04 10:09:56 +0200 |
commit | 384e7a04c66ccb49822105fb7803ffcd15a19466 (patch) | |
tree | fbfd5ebb2806c4af52b9c4f178d348e9078c199c | |
parent | de6f0bc6db35a7c6b6f70b18502a9fcb0afd5ad6 (diff) | |
download | NetworkManager-384e7a04c66ccb49822105fb7803ffcd15a19466.tar.gz |
shared: add nm_auto_unlock_g_mutex and NM_G_MUTEX_LOCKED() helper macros
-rw-r--r-- | shared/nm-glib-aux/nm-macros-internal.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/shared/nm-glib-aux/nm-macros-internal.h b/shared/nm-glib-aux/nm-macros-internal.h index 9502c442ec..b9e2640965 100644 --- a/shared/nm-glib-aux/nm-macros-internal.h +++ b/shared/nm-glib-aux/nm-macros-internal.h @@ -1989,4 +1989,18 @@ nm_close (int fd) #define NM_PID_T_INVAL ((pid_t) -1) +/*****************************************************************************/ + +NM_AUTO_DEFINE_FCN_VOID0 (GMutex *, _nm_auto_unlock_g_mutex, g_mutex_unlock) + +#define nm_auto_unlock_g_mutex nm_auto (_nm_auto_unlock_g_mutex) + +#define _NM_G_MUTEX_LOCKED(lock, uniq) \ + nm_auto_unlock_g_mutex GMutex *NM_UNIQ_T(nm_lock, uniq) = (lock) + +#define NM_G_MUTEX_LOCKED(lock) \ + _NM_G_MUTEX_LOCKED (lock, NM_UNIQ) + +/*****************************************************************************/ + #endif /* __NM_MACROS_INTERNAL_H__ */ |