Cygwin: move POSIX semaphore API functions to posix_ipc.cc

This way, the sem API is all in the same place, even if the
underlying semaphore class is still in thread.cc.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2022-08-10 18:11:57 +02:00
parent 782ef53619
commit bf1d972d5c
2 changed files with 48 additions and 50 deletions

View File

@ -518,3 +518,51 @@ sem_unlink (const char *name)
return -1;
return 0;
}
extern "C" int
sem_init (sem_t * sem, int pshared, unsigned int value)
{
return semaphore::init (sem, pshared, value);
}
extern "C" int
sem_destroy (sem_t * sem)
{
return semaphore::destroy (sem);
}
extern "C" int
sem_wait (sem_t * sem)
{
return semaphore::wait (sem);
}
extern "C" int
sem_trywait (sem_t * sem)
{
return semaphore::trywait (sem);
}
extern "C" int
sem_clockwait (sem_t * sem, clockid_t clock_id, const struct timespec *abstime)
{
return semaphore::clockwait (sem, clock_id, abstime);
}
extern "C" int
sem_timedwait (sem_t * sem, const struct timespec *abstime)
{
return semaphore::clockwait (sem, CLOCK_REALTIME, abstime);
}
extern "C" int
sem_post (sem_t *sem)
{
return semaphore::post (sem);
}
extern "C" int
sem_getvalue (sem_t * sem, int *sval)
{
return semaphore::getvalue (sem, sval);
}

View File

@ -4559,54 +4559,4 @@ pthread_getcpuclockid (pthread_t thread, clockid_t *clk_id)
return 0;
}
/* Semaphores */
int
sem_init (sem_t * sem, int pshared, unsigned int value)
{
return semaphore::init (sem, pshared, value);
}
int
sem_destroy (sem_t * sem)
{
return semaphore::destroy (sem);
}
int
sem_wait (sem_t * sem)
{
return semaphore::wait (sem);
}
int
sem_trywait (sem_t * sem)
{
return semaphore::trywait (sem);
}
int
sem_clockwait (sem_t * sem, clockid_t clock_id, const struct timespec *abstime)
{
return semaphore::clockwait (sem, clock_id, abstime);
}
int
sem_timedwait (sem_t * sem, const struct timespec *abstime)
{
return semaphore::clockwait (sem, CLOCK_REALTIME, abstime);
}
int
sem_post (sem_t *sem)
{
return semaphore::post (sem);
}
int
sem_getvalue (sem_t * sem, int *sval)
{
return semaphore::getvalue (sem, sval);
}
}