Update.
[glibc.git] / linuxthreads / semaphore.h
blobfe2b451e0709e6e47fdabd0307e33208bc5a276d
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>
19 #include <sys/types.h>
21 #include <limits.h>
23 #define SEM_VALUE_MAX INT_MAX
25 typedef struct {
26 struct { long status; int spinlock; } sem_lock;
27 int sem_value;
28 _pthread_descr sem_waiting;
29 } sem_t;
31 __BEGIN_DECLS
33 extern int sem_init __P((sem_t *__sem, int __pshared, unsigned int __value));
34 extern int sem_destroy __P((sem_t *__sem));
35 extern int sem_wait __P((sem_t *__sem));
36 extern int sem_trywait __P((sem_t *__sem));
37 extern int sem_post __P((sem_t *__sem));
38 extern int sem_getvalue __P((sem_t *__sem, int *__sval));
40 __END_DECLS
42 #endif /* semaphore.h */