Update.
[glibc.git] / linuxthreads / semaphore.h
blob0740962902ba60e61e4a27e13d00095b3bca9e36
1 /* Linuxthreads - a simple clone()-based implementation of Posix */
2 /* threads for Linux. */
3 /* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) */
4 /* */
5 /* This program is free software; you can redistribute it and/or */
6 /* modify it under the terms of the GNU Library General Public License */
7 /* as published by the Free Software Foundation; either version 2 */
8 /* of the License, or (at your option) any later version. */
9 /* */
10 /* This program is distributed in the hope that it will be useful, */
11 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
12 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
13 /* GNU Library General Public License for more details. */
15 #ifndef _SEMAPHORE_H
16 #define _SEMAPHORE_H 1
18 #include <features.h>
20 #include <limits.h>
22 #define SEM_VALUE_MAX INT_MAX
24 typedef struct {
25 struct { long status; int spinlock; } sem_lock;
26 int sem_value;
27 _pthread_descr sem_waiting;
28 } sem_t;
30 __BEGIN_DECLS
32 extern int sem_init __P((sem_t *__sem, int __pshared, unsigned int __value));
33 extern int sem_destroy __P((sem_t *__sem));
34 extern int sem_wait __P((sem_t *__sem));
35 extern int sem_trywait __P((sem_t *__sem));
36 extern int sem_post __P((sem_t *__sem));
37 extern int sem_getvalue __P((sem_t *__sem, int *__sval));
39 __END_DECLS
41 #endif /* semaphore.h */