From 6af90e160e1911b9d3e9cf5456a16ad047250c8c Mon Sep 17 00:00:00 2001 From: Love Hornquist Astrand Date: Sat, 12 Mar 2011 10:46:40 -0800 Subject: [PATCH] no support for semaphores w/o pthreads --- lib/ipc/common.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/ipc/common.c b/lib/ipc/common.c index a3619f4cf..0e8f36dd2 100644 --- a/lib/ipc/common.c +++ b/lib/ipc/common.c @@ -104,6 +104,9 @@ heim_ipc_semaphore_create(long value) { #ifdef HAVE_GCD return (heim_isemaphore)dispatch_semaphore_create(value); +#elif !defined(ENABLE_PTHREAD_SUPPORT) + heim_assert(0, "no semaphore support w/o pthreads"); + return NULL; #else heim_isemaphore s = malloc(sizeof(*s)); if (s == NULL) @@ -126,6 +129,9 @@ heim_ipc_semaphore_wait(heim_isemaphore s, time_t t) timeout = (uint64_t)t * NSEC_PER_SEC; return dispatch_semaphore_wait((dispatch_semaphore_t)s, timeout); +#elif !defined(ENABLE_PTHREAD_SUPPORT) + heim_assert(0, "no semaphore support w/o pthreads"); + return 0; #else HEIMDAL_MUTEX_lock(&s->mutex); /* if counter hits below zero, we get to wait */ @@ -156,6 +162,9 @@ heim_ipc_semaphore_signal(heim_isemaphore s) { #ifdef HAVE_GCD return dispatch_semaphore_signal((dispatch_semaphore_t)s); +#elif !defined(ENABLE_PTHREAD_SUPPORT) + heim_assert(0, "no semaphore support w/o pthreads"); + return EINVAL; #else int wakeup; HEIMDAL_MUTEX_lock(&s->mutex); @@ -171,7 +180,9 @@ void heim_ipc_semaphore_release(heim_isemaphore s) { #ifdef HAVE_GCD - return dispatch_release((dispatch_semaphore_t)s); + dispatch_release((dispatch_semaphore_t)s); +#elif !defined(ENABLE_PTHREAD_SUPPORT) + heim_assert(0, "no semaphore support w/o pthreads"); #else HEIMDAL_MUTEX_lock(&s->mutex); if (s->counter != 0) -- 2.11.4.GIT