mirror of
https://github.com/MariaDB/server.git
synced 2026-05-07 23:54:31 +02:00
semaphore.c:
semaphore fix mit-pthreads/pthreads/semaphore.c: semaphore fix
This commit is contained in:
parent
8d902b942d
commit
3efb1f9d95
1 changed files with 3 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue