diff options
Diffstat (limited to 'sal/osl/unx/system.c')
-rw-r--r-- | sal/osl/unx/system.c | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/sal/osl/unx/system.c b/sal/osl/unx/system.c index fca765566785..8c8280dff70c 100644 --- a/sal/osl/unx/system.c +++ b/sal/osl/unx/system.c @@ -207,75 +207,6 @@ int macxp_resolveAlias(char *path, int buflen) #endif /* NO_PTHREAD_RTL */ -#ifdef NO_PTHREAD_SEMAPHORES -int sem_init(sem_t* sem, int pshared, unsigned int value) -{ - (void)pshared; - pthread_mutex_init(&sem->mutex, PTHREAD_MUTEXATTR_DEFAULT); - pthread_cond_init(&sem->increased, PTHREAD_CONDATTR_DEFAULT); - - sem->value = (int)value; - return 0; -} - -int sem_destroy(sem_t* sem) -{ - pthread_mutex_destroy(&sem->mutex); - pthread_cond_destroy(&sem->increased); - sem->value = 0; - return 0; -} - -int sem_wait(sem_t* sem) -{ - pthread_mutex_lock(&sem->mutex); - - while (sem->value <= 0) - { - pthread_cond_wait(&sem->increased, &sem->mutex); - } - - sem->value--; - pthread_mutex_unlock(&sem->mutex); - - return 0; -} - -int sem_trywait(sem_t* sem) -{ - int result = 0; - - pthread_mutex_lock(&sem->mutex); - - if (sem->value > 0) - { - sem->value--; - } - else - { - errno = EAGAIN; - result = -1; - } - - pthread_mutex_unlock(&sem->mutex); - - return result; -} - -int sem_post(sem_t* sem) -{ - pthread_mutex_lock(&sem->mutex); - - sem->value++; - - pthread_mutex_unlock(&sem->mutex); - - pthread_cond_signal(&sem->increased); - - return 0; -} -#endif - #if defined(FREEBSD) char *fcvt(double value, int ndigit, int *decpt, int *sign) { |