summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2015-09-01 00:40:28 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2015-09-01 00:43:17 +0200
commit6daf38a225249e050c56b338d4bd4d0de4f5fd66 (patch)
treeea1a8fbc2b66528093754fdf4fb781174e7f0035
parentb1905e805d9a04b3dc624eadb506401c1a064812 (diff)
Harmonize semaphore.h with glibc
* include/semaphore.h: Reorder function declarations, prepend parameter names with __. (sem_init, sem_destroy, *sem_open, sem_close, sem_unlink, sem_getvalue): Add __THROW attribute. (sem_trywait, sem_post): Add __THROWNL attribute.
-rw-r--r--include/semaphore.h51
1 files changed, 29 insertions, 22 deletions
diff --git a/include/semaphore.h b/include/semaphore.h
index 5c05a72..64249f6 100644
--- a/include/semaphore.h
+++ b/include/semaphore.h
@@ -26,48 +26,55 @@
# 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