summaryrefslogtreecommitdiff
path: root/src/secmem.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2014-01-09 19:14:09 +0100
committerWerner Koch <wk@gnupg.org>2014-01-16 17:23:21 +0100
commitcfc151ba637200e4fc05d9481a8df2071b2f9a47 (patch)
treef1a1c3e1fc81663d622dd5189462a249bd01eac3 /src/secmem.c
parent49edeebb43174865cf4fa2c170a42a8e4274c4f0 (diff)
downloadlibgcrypt-cfc151ba637200e4fc05d9481a8df2071b2f9a47.tar.gz
Replace ath based mutexes by gpgrt based locks.
* configure.ac (NEED_GPG_ERROR_VERSION): Require 1.13. (gl_LOCK): Remove. * src/ath.c, src/ath.h: Remove. Remove from all files. Replace all mutexes by gpgrt based statically initialized locks. * src/global.c (global_init): Remove ath_init. (_gcry_vcontrol): Make ath install a dummy function. (print_config): Remove threads info line. * doc/gcrypt.texi: Simplify the multi-thread related documentation. -- The current code does only work on ELF systems with weak symbol support. In particular no locks were used under Windows. With the new gpgrt_lock functions from the soon to be released libgpg-error 1.13 we have a better portable scheme which also allows for static initialized mutexes. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'src/secmem.c')
-rw-r--r--src/secmem.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/secmem.c b/src/secmem.c
index 2bf7d8c6..cfea9213 100644
--- a/src/secmem.c
+++ b/src/secmem.c
@@ -37,7 +37,6 @@
#endif
#endif
-#include "ath.h"
#include "g10lib.h"
#include "secmem.h"
@@ -86,11 +85,11 @@ static int no_priv_drop;
static unsigned int cur_alloced, cur_blocks;
/* Lock protecting accesses to the memory pool. */
-static ath_mutex_t secmem_lock;
+GPGRT_LOCK_DEFINE (secmem_lock);
/* Convenient macros. */
-#define SECMEM_LOCK ath_mutex_lock (&secmem_lock)
-#define SECMEM_UNLOCK ath_mutex_unlock (&secmem_lock)
+#define SECMEM_LOCK gpgrt_lock_lock (&secmem_lock)
+#define SECMEM_UNLOCK gpgrt_lock_unlock (&secmem_lock)
/* The size of the memblock structure; this does not include the
memory that is available to the user. */
@@ -536,12 +535,7 @@ _gcry_secmem_init (size_t n)
gcry_err_code_t
_gcry_secmem_module_init ()
{
- int err;
-
- err = ath_mutex_init (&secmem_lock);
- if (err)
- log_fatal ("could not allocate secmem lock\n");
-
+ /* No anymore needed. */
return 0;
}