summaryrefslogtreecommitdiff
path: root/lib/locks.h
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@gnu.org>2021-11-14 16:39:29 +0100
committerDaiki Ueno <ueno@gnu.org>2021-11-17 07:38:35 +0100
commitbcffed047f7a228cf99028eb2b8249e5a02eb2e6 (patch)
tree555eba78c10de55b63ee5d41a338309828faa9ff /lib/locks.h
parent14dd5bbe4a6f8482e69a2c0ffba4fa258c9b236e (diff)
downloadgnutls-bcffed047f7a228cf99028eb2b8249e5a02eb2e6.tar.gz
locks: rework rwlock primitives
Remove GNUTLS_STATIC_RWLOCK_*LOCK macros and respect return values of rwlock primitives. Signed-off-by: Daiki Ueno <ueno@gnu.org>
Diffstat (limited to 'lib/locks.h')
-rw-r--r--lib/locks.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/locks.h b/lib/locks.h
index 99bf083fd1..b48d2e702b 100644
--- a/lib/locks.h
+++ b/lib/locks.h
@@ -43,9 +43,15 @@ typedef gl_lock_t *gnutls_static_mutex_t;
int gnutls_static_mutex_lock(gnutls_static_mutex_t lock);
int gnutls_static_mutex_unlock(gnutls_static_mutex_t lock);
-#define GNUTLS_STATIC_RWLOCK(rwlock) gl_rwlock_define_initialized(static, rwlock)
-#define GNUTLS_STATIC_RWLOCK_RDLOCK gl_rwlock_rdlock
-#define GNUTLS_STATIC_RWLOCK_WRLOCK gl_rwlock_wrlock
-#define GNUTLS_STATIC_RWLOCK_UNLOCK gl_rwlock_unlock
+/* Unlike static mutexes, static rwlocks can be locked/unlocked with
+ * the functions defined below, because there is no way to replace
+ * those functions.
+ */
+#define GNUTLS_RWLOCK(rwlock) gl_rwlock_define_initialized(static, rwlock)
+typedef gl_rwlock_t *gnutls_rwlock_t;
+
+int gnutls_rwlock_rdlock(gnutls_rwlock_t rwlock);
+int gnutls_rwlock_wrlock(gnutls_rwlock_t rwlock);
+int gnutls_rwlock_unlock(gnutls_rwlock_t rwlock);
#endif /* GNUTLS_LIB_LOCKS_H */