Commit 3efb1f9d authored by unknown's avatar unknown

semaphore.c:

  semaphore fix


mit-pthreads/pthreads/semaphore.c:
  semaphore fix
parent 8d902b94
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment