summaryrefslogtreecommitdiff
path: root/src/posix-lock-obj.h
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2015-06-15 10:32:11 +0200
committerWerner Koch <wk@gnupg.org>2015-06-15 10:32:11 +0200
commit13918d05a333255d22aa6718dd467fcb8eaf80c8 (patch)
tree8ae6fb48ee7e93bf12cc92b578abe6b36292fa10 /src/posix-lock-obj.h
parent4171d61a97d9628532db84b590a9c135f360fa90 (diff)
downloadlibgpg-error-13918d05a333255d22aa6718dd467fcb8eaf80c8.tar.gz
Allow building with --disable-threads.
* src/posix-lock-obj.h (LOCK_ABI_NOT_AVAILABLE): New. (LOCK_ABI_VERSION): Define depending on USE_POSIX_THREADS. (_gpgrt_lock_t) [!USE_POSIX_THREADS]: Do not define the union. * src/gen-posix-lock-obj.c: Take care of USE_POSIX_THREADS. * src/posix-lock.c (_gpgrt_lock_init, _gpgrt_lock_lock) (_gpgrt_lock_trylock, _gpgrt_lock_unlock) (_gpgrt_lock_destroy): Return success for a no-threads version. * tests/t-lock.c: Disable tests if threads are not available. * src/mkheader.c (main): Add NO-THREADS to the printed comment. * configure.ac: Show NO-TRHEADS in the final summary. -- Warning: Using --disable-threads creates a different ABI which we can't encode in the the cpu-vendor-os triplet. The run time checks should detect this and abort the process. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'src/posix-lock-obj.h')
-rw-r--r--src/posix-lock-obj.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/posix-lock-obj.h b/src/posix-lock-obj.h
index 7714d3c..872e55a 100644
--- a/src/posix-lock-obj.h
+++ b/src/posix-lock-obj.h
@@ -20,15 +20,22 @@
#ifndef POSIX_LOCK_OBJ_H
#define POSIX_LOCK_OBJ_H
-#define LOCK_ABI_VERSION 1
+#define LOCK_ABI_NOT_AVAILABLE (-1)
+#if USE_POSIX_THREADS
+# define LOCK_ABI_VERSION 1
+#else
+# define LOCK_ABI_VERSION LOCK_ABI_NOT_AVAILABLE
+#endif
typedef struct
{
long vers;
+#if USE_POSIX_THREADS
union {
pthread_mutex_t mtx;
long *dummy;
} u;
+#endif
} _gpgrt_lock_t;