summaryrefslogtreecommitdiff
path: root/lib/locks.c
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@gnu.org>2021-11-14 14:04:59 +0100
committerDaiki Ueno <ueno@gnu.org>2021-11-17 07:36:49 +0100
commit482380e9eb78ee134ca985fd7d03306b07c457ce (patch)
tree8a358b201de09add571da85c9038c2de2531fa50 /lib/locks.c
parenta957c6c0b4abf6cb1c9756ef10e8b884cf7ae8aa (diff)
downloadgnutls-482380e9eb78ee134ca985fd7d03306b07c457ce.tar.gz
locks: replace custom mutex wrappers with "glthread/lock.h"
As Gnulib provides portability wrappers of mutex implementations, we don't need to provide similar wrappers by ourselves. Signed-off-by: Daiki Ueno <ueno@gnu.org>
Diffstat (limited to 'lib/locks.c')
-rw-r--r--lib/locks.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/locks.c b/lib/locks.c
index d9ea4d77b5..67f4e1b329 100644
--- a/lib/locks.c
+++ b/lib/locks.c
@@ -72,3 +72,21 @@ int ret;
if (ret < 0)
_gnutls_debug_log("error in gnutls_global_init(): %s\n", gnutls_strerror(ret));
}
+
+int
+gnutls_static_mutex_lock(gnutls_static_mutex_t lock)
+{
+ if (unlikely(glthread_lock_lock(lock))) {
+ return gnutls_assert_val(GNUTLS_E_LOCKING_ERROR);
+ }
+ return 0;
+}
+
+int
+gnutls_static_mutex_unlock(gnutls_static_mutex_t lock)
+{
+ if (unlikely(glthread_lock_unlock(lock))) {
+ return gnutls_assert_val(GNUTLS_E_LOCKING_ERROR);
+ }
+ return 0;
+}