diff options
-rw-r--r-- | src/atomic_ops.c | 13 | ||||
-rw-r--r-- | tests/test_atomic.c | 12 |
2 files changed, 19 insertions, 6 deletions
diff --git a/src/atomic_ops.c b/src/atomic_ops.c index 3017fc4..30dd21c 100644 --- a/src/atomic_ops.c +++ b/src/atomic_ops.c @@ -49,7 +49,9 @@ #if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__BORLANDC__) \ || defined(AO_USE_NO_SIGNALS) -#include <pthread.h> +#ifndef AO_NO_PTHREADS +# include <pthread.h> +#endif #ifndef AO_USE_NO_SIGNALS # include <signal.h> @@ -71,11 +73,10 @@ # include "atomic_ops/sysdeps/standard_ao_double_t.h" #endif -/* - * Lock for pthreads-based implementation. - */ - -pthread_mutex_t AO_pt_lock = PTHREAD_MUTEX_INITIALIZER; +/* Lock for pthreads-based implementation. */ +#ifndef AO_NO_PTHREADS + pthread_mutex_t AO_pt_lock = PTHREAD_MUTEX_INITIALIZER; +#endif /* * Out of line compare-and-swap emulation based on test and set. diff --git a/tests/test_atomic.c b/tests/test_atomic.c index 6ce690a..980fb6b 100644 --- a/tests/test_atomic.c +++ b/tests/test_atomic.c @@ -15,6 +15,16 @@ # include "config.h" #endif +#if defined(AO_NO_PTHREADS) && defined(AO_USE_PTHREAD_DEFS) +# include <stdio.h> + + int main(void) + { + printf("test skipped\n"); + return 0; + } + +#else #include "run_parallel.h" @@ -190,3 +200,5 @@ int main(void) # endif return 0; } + +#endif /* !AO_NO_PTHREADS || !AO_USE_PTHREAD_DEFS */ |