diff options
author | Daiki Ueno <ueno@gnu.org> | 2021-10-30 17:17:47 +0200 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2021-11-05 13:59:51 +0100 |
commit | df30540e0088ef3995e171132c47dfeeb67cbfd1 (patch) | |
tree | 39a44098a9ae99f8f24009321c9f6f2f48057ba3 /lib/locks.h | |
parent | 1971491c722ebbedf06b5e6727caea407f7217d9 (diff) | |
download | gnutls-df30540e0088ef3995e171132c47dfeeb67cbfd1.tar.gz |
priority: rework config reloading logic and locking
The previous reloading logic relied on the existence of [priority]
section (in the initial loading) as an indicator whether the file is
loaded. This didn't work well in the following cases:
- when the section didn't exist initially and then is added later
- when the section existed initially and then is removed later
To handle these cases, this change adds a new flag
system_priority_file_loaded which can be used together with the mtime
check.
This also adds an rwlock to protect global configuration.
Signed-off-by: Daiki Ueno <ueno@gnu.org>
Diffstat (limited to 'lib/locks.h')
-rw-r--r-- | lib/locks.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/locks.h b/lib/locks.h index 63780bf571..51a0f56f43 100644 --- a/lib/locks.h +++ b/lib/locks.h @@ -26,6 +26,7 @@ #include <gnutls/gnutls.h> #include "gnutls_int.h" #include <system.h> +#include "glthread/lock.h" #ifdef HAVE_STDATOMIC_H # include <stdatomic.h> @@ -76,4 +77,9 @@ extern mutex_unlock_func gnutls_mutex_unlock; # define GNUTLS_STATIC_MUTEX_UNLOCK(mutex) #endif +#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 + #endif /* GNUTLS_LIB_LOCKS_H */ |