diff options
author | davidxu <davidxu@FreeBSD.org> | 2004-01-17 07:15:06 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2004-01-17 07:15:06 +0000 |
commit | cfbecaf585129383dad14d1d9cb791aafdfe4a60 (patch) | |
tree | 842090fc1aff79787d967520f7d1416875715f6c /lib | |
parent | 813cc04125bee8f7f0e6165a7d63287c4da2d13f (diff) | |
download | FreeBSD-src-cfbecaf585129383dad14d1d9cb791aafdfe4a60.zip FreeBSD-src-cfbecaf585129383dad14d1d9cb791aafdfe4a60.tar.gz |
Backout revision 1.6, because some stub functions not in libc, and
non-threaded won't build. The cancellation point support should be
further discussed.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/gen/sem.c | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/lib/libc/gen/sem.c b/lib/libc/gen/sem.c index e9a918b..e37eccd 100644 --- a/lib/libc/gen/sem.c +++ b/lib/libc/gen/sem.c @@ -254,19 +254,7 @@ sem_unlink(const char *name) return (ksem_unlink(name)); } -static void -decrease_nwaiters(void *arg) -{ - sem_t *sem = (sem_t *)arg; - - (*sem)->nwaiters--; - /* - * this function is called from cancellation point, - * the mutex should already be hold. - */ - _pthread_mutex_unlock(&(*sem)->lock); -} - +int sem_wait(sem_t *sem) { int retval; @@ -278,15 +266,11 @@ sem_wait(sem_t *sem) goto RETURN; } - _pthread_testcancel(); - _pthread_mutex_lock(&(*sem)->lock); while ((*sem)->count == 0) { (*sem)->nwaiters++; - _pthread_cleanup_push(decrease_nwaiters); - pthread_cond_wait(&(*sem)->gtzero, &(*sem)->lock); - pthread_cleanup_pop(0); + _pthread_cond_wait(&(*sem)->gtzero, &(*sem)->lock); (*sem)->nwaiters--; } (*sem)->count--; |