diff options
author | Daiki Ueno <ueno@gnu.org> | 2021-11-14 16:39:29 +0100 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2021-11-17 07:38:35 +0100 |
commit | bcffed047f7a228cf99028eb2b8249e5a02eb2e6 (patch) | |
tree | 555eba78c10de55b63ee5d41a338309828faa9ff /lib/locks.c | |
parent | 14dd5bbe4a6f8482e69a2c0ffba4fa258c9b236e (diff) | |
download | gnutls-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.c')
-rw-r--r-- | lib/locks.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/locks.c b/lib/locks.c index 67f4e1b329..3c05e4d988 100644 --- a/lib/locks.c +++ b/lib/locks.c @@ -90,3 +90,30 @@ gnutls_static_mutex_unlock(gnutls_static_mutex_t lock) } return 0; } + +int +gnutls_rwlock_rdlock(gnutls_rwlock_t rwlock) +{ + if (unlikely(glthread_rwlock_rdlock(rwlock))) { + return gnutls_assert_val(GNUTLS_E_LOCKING_ERROR); + } + return 0; +} + +int +gnutls_rwlock_wrlock(gnutls_rwlock_t rwlock) +{ + if (unlikely(glthread_rwlock_wrlock(rwlock))) { + return gnutls_assert_val(GNUTLS_E_LOCKING_ERROR); + } + return 0; +} + +int +gnutls_rwlock_unlock(gnutls_rwlock_t rwlock) +{ + if (unlikely(glthread_rwlock_unlock(rwlock))) { + return gnutls_assert_val(GNUTLS_E_LOCKING_ERROR); + } + return 0; +} |