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/thread.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'winsup/cygwin/thread.h') diff --git a/winsup/cygwin/thread.h b/winsup/cygwin/thread.h index 575310958..d6fffedb8 100644 --- a/winsup/cygwin/thread.h +++ b/winsup/cygwin/thread.h @@ -710,15 +710,21 @@ public: /* API calls */ static int init (sem_t * sem, int pshared, unsigned int value); static int destroy (sem_t * sem); + static sem_t *open (const char *name, int oflag, mode_t mode, + unsigned int value); static int wait (sem_t * sem); - static int trywait (sem_t * sem); static int post (sem_t * sem); + static int getvalue (sem_t * sem, int *sval); + static int trywait (sem_t * sem); + static int timedwait (sem_t * sem, const struct timespec *abstime); HANDLE win32_obj_id; int shared; long currentvalue; + char *name; semaphore (int, unsigned int); + semaphore (const char *name, int oflag, mode_t mode, unsigned int value); ~semaphore (); class semaphore * next; @@ -731,7 +737,9 @@ public: private: void _wait (); void _post (); + int _getvalue (int *sval); int _trywait (); + int _timedwait (const struct timespec *abstime); void _fixup_after_fork (); -- cgit v1.2.3