summaryrefslogtreecommitdiff
path: root/include/semaphore.h
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2015-11-01 11:55:35 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2015-11-01 11:55:35 +0100
commit3c237122a91c0a782183c63e9c277ab97837b9cf (patch)
tree8d48ea190a778eaedaa182b7a58abae43a157345 /include/semaphore.h
parent0cb5361e21196dcc2bd8a1763af5c6f0cf82ca5f (diff)
parentc7c777b3d43d490c2012f6b8e6a61c455479fbbc (diff)
Merge branch 'master-glibc' into master-glibc-2.21
Diffstat (limited to 'include/semaphore.h')
-rw-r--r--include/semaphore.h56
1 files changed, 34 insertions, 22 deletions
diff --git a/include/semaphore.h b/include/semaphore.h
index 657e796..64249f6 100644
--- a/include/semaphore.h
+++ b/include/semaphore.h
@@ -20,49 +20,61 @@
#define _SEMAPHORE_H 1
#include <features.h>
+#include <sys/types.h>
+#ifdef __USE_XOPEN2K
+# define __need_timespec
+# include <time.h>
+#endif
-__BEGIN_DECLS
-
+/* Get the definition for struct __semaphore. */
#include <bits/semaphore.h>
+
+__BEGIN_DECLS
+
#define SEM_FAILED ((void *) 0)
typedef struct __semaphore sem_t;
/* Initialize semaphore *SEM with value VALUE. */
-extern int sem_init (sem_t *sem, int pshared, unsigned value);
-
+extern int sem_init (sem_t *__sem, int __pshared, unsigned int __value)
+ __THROW;
/* Destroy semaphore *SEM created with sem_init. */
-extern int sem_destroy (sem_t *sem);
+extern int sem_destroy (sem_t *__sem) __THROW;
-/* Store the value of semaphore *SEM in *VALUE. */
-extern int sem_getvalue (sem_t *__restrict sem, int *__restrict value);
+/* Open a named semaphore. */
+extern sem_t *sem_open (const char *__name, int __oflag, ...) __THROW;
-/* Perform a down operation on semaphore *SEM. */
-extern int sem_wait (sem_t *sem);
+/* Close a semaphore returned by sem_open. */
+extern int sem_close (sem_t *__sem) __THROW;
-/* Perform a down operation on semaphore *SEM if it can be done so
- without blocking. */
-extern int sem_trywait (sem_t *sem);
+/* Unlink a named semaphore. */
+extern int sem_unlink (const char *__name) __THROW;
+
+/* Perform a down operation on semaphore *SEM.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int sem_wait (sem_t *__sem);
#ifdef __USE_XOPEN2K
/* Perform a down operation on semaphore *SEM but don't wait longer
than TIMEOUT. */
-extern int sem_timedwait (sem_t *__restrict sem,
- const struct timespec *__restrict timeout);
+extern int sem_timedwait (sem_t *__restrict __sem,
+ const struct timespec *__restrict __abstime);
#endif
-/* Perform an up operation on semaphore *SEM. */
-extern int sem_post (sem_t *sem);
+/* Perform a down operation on semaphore *SEM if it can be done so
+ without blocking. */
+extern int sem_trywait (sem_t *__sem) __THROWNL;
-/* Open a named semaphore. */
-extern sem_t *sem_open (const char *name, int open_flags, ...);
+/* Perform an up operation on semaphore *SEM. */
+extern int sem_post (sem_t *__sem) __THROWNL;
-/* Close a semaphore returned by sem_open. */
-extern int sem_close (sem_t *sem);
+/* Store the value of semaphore *SEM in *VALUE. */
+extern int sem_getvalue (sem_t *__restrict __sem, int *__restrict __sval)
+ __THROW;
-/* Unlink a named semaphore. */
-extern int sem_unlink (const char *name);
__END_DECLS