1 /* Linuxthreads - a simple clone()-based implementation of Posix */
2 /* threads for Linux. */
3 /* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) */
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. */
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. */
16 #define _SEMAPHORE_H 1
19 #include <sys/types.h>
23 #define SEM_VALUE_MAX INT_MAX
26 struct { long status
; int spinlock
; } sem_lock
;
28 _pthread_descr sem_waiting
;
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
));
42 #endif /* semaphore.h */