From 13918d05a333255d22aa6718dd467fcb8eaf80c8 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 15 Jun 2015 10:32:11 +0200 Subject: 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 --- src/posix-lock.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/posix-lock.c') diff --git a/src/posix-lock.c b/src/posix-lock.c index 89be944..d8f5465 100644 --- a/src/posix-lock.c +++ b/src/posix-lock.c @@ -155,7 +155,7 @@ _gpgrt_lock_init (gpgrt_lock_t *lockhd) else rc = 0; /* Threads are not used. */ #else /* Unknown thread system. */ - rc = GPG_ERR_NOT_IMPLEMENTED; + rc = lock->vers == LOCK_ABI_NOT_AVAILABLE? 0 : GPG_ERR_NOT_IMPLEMENTED; #endif /* Unknown thread system. */ return rc; @@ -178,7 +178,7 @@ _gpgrt_lock_lock (gpgrt_lock_t *lockhd) else rc = 0; /* Threads are not used. */ #else /* Unknown thread system. */ - rc = GPG_ERR_NOT_IMPLEMENTED; + rc = lock->vers == LOCK_ABI_NOT_AVAILABLE? 0 : GPG_ERR_NOT_IMPLEMENTED; #endif /* Unknown thread system. */ return rc; @@ -201,7 +201,7 @@ _gpgrt_lock_trylock (gpgrt_lock_t *lockhd) else rc = 0; /* Threads are not used. */ #else /* Unknown thread system. */ - rc = GPG_ERR_NOT_IMPLEMENTED; + rc = lock->vers == LOCK_ABI_NOT_AVAILABLE? 0 : GPG_ERR_NOT_IMPLEMENTED; #endif /* Unknown thread system. */ return rc; @@ -224,7 +224,7 @@ _gpgrt_lock_unlock (gpgrt_lock_t *lockhd) else rc = 0; /* Threads are not used. */ #else /* Unknown thread system. */ - rc = GPG_ERR_NOT_IMPLEMENTED; + rc = lock->vers == LOCK_ABI_NOT_AVAILABLE? 0 : GPG_ERR_NOT_IMPLEMENTED; #endif /* Unknown thread system. */ return rc; @@ -255,7 +255,7 @@ _gpgrt_lock_destroy (gpgrt_lock_t *lockhd) else rc = 0; /* Threads are not used. */ #else /* Unknown thread system. */ - rc = GPG_ERR_NOT_IMPLEMENTED; + rc = lock->vers == LOCK_ABI_NOT_AVAILABLE? 0 : GPG_ERR_NOT_IMPLEMENTED; #endif /* Unknown thread system. */ return rc; -- cgit v1.2.3