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.
This commit is contained in:
davidxu 2004-01-17 07:15:06 +00:00
parent 813cc04125
commit cfbecaf585

View File

@ -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--;