aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.4.3/boehm-gc/include/private/darwin_semaphore.h
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2015-06-17 11:09:54 -0700
committerDan Albert <danalbert@google.com>2015-06-17 14:15:22 -0700
commitf378ebf14df0952eae870c9865bab8326aa8f137 (patch)
tree31794503eb2a8c64ea5f313b93100f1163afcffb /gcc-4.4.3/boehm-gc/include/private/darwin_semaphore.h
parent2c58169824949d3a597d9fa81931e001ef9b1bd0 (diff)
downloadtoolchain_gcc-f378ebf14df0952eae870c9865bab8326aa8f137.tar.gz
toolchain_gcc-f378ebf14df0952eae870c9865bab8326aa8f137.tar.bz2
toolchain_gcc-f378ebf14df0952eae870c9865bab8326aa8f137.zip
Delete old versions of GCC.
Change-Id: I710f125d905290e1024cbd67f48299861790c66c
Diffstat (limited to 'gcc-4.4.3/boehm-gc/include/private/darwin_semaphore.h')
-rw-r--r--gcc-4.4.3/boehm-gc/include/private/darwin_semaphore.h68
1 files changed, 0 insertions, 68 deletions
diff --git a/gcc-4.4.3/boehm-gc/include/private/darwin_semaphore.h b/gcc-4.4.3/boehm-gc/include/private/darwin_semaphore.h
deleted file mode 100644
index 0f43982d5..000000000
--- a/gcc-4.4.3/boehm-gc/include/private/darwin_semaphore.h
+++ /dev/null
@@ -1,68 +0,0 @@
-#ifndef GC_DARWIN_SEMAPHORE_H
-#define GC_DARWIN_SEMAPHORE_H
-
-#if !defined(GC_DARWIN_THREADS)
-#error darwin_semaphore.h included with GC_DARWIN_THREADS not defined
-#endif
-
-/*
- This is a very simple semaphore implementation for darwin. It
- is implemented in terms of pthreads calls so it isn't async signal
- safe. This isn't a problem because signals aren't used to
- suspend threads on darwin.
-*/
-
-typedef struct {
- pthread_mutex_t mutex;
- pthread_cond_t cond;
- int value;
-} sem_t;
-
-static int sem_init(sem_t *sem, int pshared, int value) {
- int ret;
- if(pshared)
- GC_abort("sem_init with pshared set");
- sem->value = value;
-
- ret = pthread_mutex_init(&sem->mutex,NULL);
- if(ret < 0) return -1;
- ret = pthread_cond_init(&sem->cond,NULL);
- if(ret < 0) return -1;
- return 0;
-}
-
-static int sem_post(sem_t *sem) {
- if(pthread_mutex_lock(&sem->mutex) < 0)
- return -1;
- sem->value++;
- if(pthread_cond_signal(&sem->cond) < 0) {
- pthread_mutex_unlock(&sem->mutex);
- return -1;
- }
- if(pthread_mutex_unlock(&sem->mutex) < 0)
- return -1;
- return 0;
-}
-
-static int sem_wait(sem_t *sem) {
- if(pthread_mutex_lock(&sem->mutex) < 0)
- return -1;
- while(sem->value == 0) {
- pthread_cond_wait(&sem->cond,&sem->mutex);
- }
- sem->value--;
- if(pthread_mutex_unlock(&sem->mutex) < 0)
- return -1;
- return 0;
-}
-
-static int sem_destroy(sem_t *sem) {
- int ret;
- ret = pthread_cond_destroy(&sem->cond);
- if(ret < 0) return -1;
- ret = pthread_mutex_destroy(&sem->mutex);
- if(ret < 0) return -1;
- return 0;
-}
-
-#endif