From 072339664df6b89b2e106f6507b0dd65fc882d55 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 27 Oct 2003 11:48:29 +0000 Subject: * cygwin.din: Add sem_close, sem_getvalue, sem_open and sem_timedwait. * pthread.cc (+mangle_sem_name): New function. (sem_open): Ditto. (sem_close: Ditto. (sem_timedwait): Ditto. (sem_getvalue): Ditto. * thread.cc (semaphore::semaphore): Rearrange member initialization. Use appropriate security attribute for process shared semaphores. (semaphore::semaphore): New constructor for named semaphores. (semaphore::~semaphore): Care for semaphore name. (semaphore::_post): Accomodate failing ReleaseSemaphore. Use value returned by ReleaseSemaphore vor currentvalue. (semaphore::_getvalue): New method. (semaphore::_timedwait): Ditto. (semaphore::_fixup_after_fork): Rearrange. Don't fail for process shared semaphores. (semaphore::open): New method. (semaphore::timedwait): Ditto. (semaphore::post): Fix return value. Set errno appropriately. (semaphore::getvalue): New method. * thread.h (class semaphore): Add prototypes for open, getvalue, timedwait, _getvalue, _timedwait. Add prototypes for new constructor. Add name member. * include/semaphore.h: Add prototypes for sem_open, sem_close, sem_timedwait and sem_getvalue. include/cygwin/version.h: Bump API minor number. --- winsup/cygwin/include/cygwin/version.h | 3 ++- winsup/cygwin/include/semaphore.h | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'winsup/cygwin/include') diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index 0e26b0840..a3214e445 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -221,13 +221,14 @@ details. */ optreset, __check_rhosts_file, __rcmd_errstr. 95: Export shmat, shmctl, shmdt, shmget. 96: CW_GET_ERRNO_FROM_WINERROR addition to external.cc + 97: Export sem_open, sem_close, sem_timedwait, sem_getvalue. */ /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */ #define CYGWIN_VERSION_API_MAJOR 0 -#define CYGWIN_VERSION_API_MINOR 96 +#define CYGWIN_VERSION_API_MINOR 97 /* There is also a compatibity version number associated with the shared memory regions. It is incremented when incompatible diff --git a/winsup/cygwin/include/semaphore.h b/winsup/cygwin/include/semaphore.h index 860c2bfca..96f7c6f88 100644 --- a/winsup/cygwin/include/semaphore.h +++ b/winsup/cygwin/include/semaphore.h @@ -30,9 +30,13 @@ extern "C" /* Semaphores */ int sem_init (sem_t * sem, int pshared, unsigned int value); int sem_destroy (sem_t * sem); + sem_t *sem_open (const char *name, int oflag, ...); + int sem_close (sem_t *sem); int sem_wait (sem_t * sem); int sem_trywait (sem_t * sem); + int sem_timedwait (sem_t * sem, const struct timespec *abstime); int sem_post (sem_t * sem); + int sem_getvalue (sem_t * sem, int *sval); #ifdef __cplusplus } -- cgit v1.2.3