semaphore.c:

semaphore fix


mit-pthreads/pthreads/semaphore.c:
  semaphore fix
This commit is contained in:
unknown 2002-06-21 19:20:56 +00:00
commit 3efb1f9d95

View file

@ -32,7 +32,9 @@ int sem_destroy(sem_t * sem)
int sem_wait(sem_t * sem)
{
while ((errno=pthread_mutex_lock(&sem->mutex)) || !sem->count)
if ((errno=pthread_mutex_lock(&sem->mutex)))
return -1;
while (!sem->count)
pthread_cond_wait(&sem->cond, &sem->mutex);
if (errno)
return -1;