diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2013-12-04 09:49:26 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2013-12-04 09:49:26 +0100 |
commit | 4d5db2069f8cead0abec31a5e36e709dd8b60abf (patch) | |
tree | 6e84ba37fa42a435bf197254b01bf267e64a364f | |
parent | 61e891599178fa95161b99a09982bfe9846504ed (diff) | |
download | gnutls-4d5db2069f8cead0abec31a5e36e709dd8b60abf.tar.gz |
do not deinitialize a static mutex to avoid any side-effects.
-rw-r--r-- | lib/gnutls_global.c | 4 | ||||
-rw-r--r-- | lib/locks.h | 11 |
2 files changed, 1 insertions, 14 deletions
diff --git a/lib/gnutls_global.c b/lib/gnutls_global.c index 4e8043efa3..e499990cf9 100644 --- a/lib/gnutls_global.c +++ b/lib/gnutls_global.c @@ -383,7 +383,6 @@ void gnutls_global_deinit(void) GNUTLS_STATIC_MUTEX_LOCK(global_init_mutex); if (_gnutls_init == 1) { _gnutls_init = 0; - GNUTLS_STATIC_MUTEX_UNLOCK(global_init_mutex); gl_sockets_cleanup(); gnutls_crypto_deinit(); _gnutls_rnd_deinit(); @@ -404,12 +403,11 @@ void gnutls_global_deinit(void) gnutls_mutex_deinit(&_gnutls_file_mutex); loaded_modules = 0; - GNUTLS_STATIC_MUTEX_DEINIT(global_init_mutex); } else { if (_gnutls_init > 0) _gnutls_init--; - GNUTLS_STATIC_MUTEX_UNLOCK(global_init_mutex); } + GNUTLS_STATIC_MUTEX_UNLOCK(global_init_mutex); } /** diff --git a/lib/locks.h b/lib/locks.h index cf989c6f78..d046341ea4 100644 --- a/lib/locks.h +++ b/lib/locks.h @@ -55,10 +55,6 @@ extern mutex_unlock_func gnutls_mutex_unlock; # define GNUTLS_STATIC_MUTEX_UNLOCK(mutex) \ LeaveCriticalSection(mutex) -# define GNUTLS_STATIC_MUTEX_DEINIT(mutex) \ - DeleteCriticalSection(mutex); \ - free(mutex); mutex = NULL - #elif defined(HAVE_PTHREAD_LOCKS) # include <pthread.h> # define GNUTLS_STATIC_MUTEX(mutex) \ @@ -70,17 +66,10 @@ extern mutex_unlock_func gnutls_mutex_unlock; # define GNUTLS_STATIC_MUTEX_UNLOCK(mutex) \ pthread_mutex_unlock(&mutex) -# define GNUTLS_STATIC_MUTEX_DEINIT(mutex) { \ - static const pthread_mutex_t t = PTHREAD_MUTEX_INITIALIZER; \ - pthread_mutex_destroy(&mutex); \ - memcpy(&mutex, &t, sizeof(mutex)); \ - } - #else # define GNUTLS_STATIC_MUTEX(mutex) # define GNUTLS_STATIC_MUTEX_LOCK(mutex) # define GNUTLS_STATIC_MUTEX_UNLOCK(mutex) -# define GNUTLS_STATIC_MUTEX_DEINIT(mutex) #endif #endif |