RetroArch
semaphore.h
Go to the documentation of this file.
1 /*
2  * Module: semaphore.h
3  *
4  * Purpose:
5  * Semaphores aren't actually part of the PThreads standard.
6  * They are defined by the POSIX Standard:
7  *
8  * POSIX 1003.1b-1993 (POSIX.1b)
9  *
10  * --------------------------------------------------------------------------
11  *
12  * Pthreads-embedded (PTE) - POSIX Threads Library for embedded systems
13  * Copyright(C) 2008 Jason Schmidlapp
14  *
15  * Contact Email: [email protected]
16  *
17  *
18  * Pthreads-embedded (PTE) - POSIX Threads Library for embedded systems
19  * Copyright(C) 2008 Jason Schmidlapp
20  *
21  * Contact Email: [email protected]
22  *
23  *
24  * Based upon Pthreads-win32 - POSIX Threads Library for Win32
25  * Copyright(C) 1998 John E. Bossom
26  * Copyright(C) 1999,2005 Pthreads-win32 contributors
27  *
28  * Contact Email: [email protected]
29  *
30  * The original list of contributors to the Pthreads-win32 project
31  * is contained in the file CONTRIBUTORS.ptw32 included with the
32  * source code distribution. The list can also be seen at the
33  * following World Wide Web location:
34  * http://sources.redhat.com/pthreads-win32/contributors.html
35  *
36  * This library is free software; you can redistribute it and/or
37  * modify it under the terms of the GNU Lesser General Public
38  * License as published by the Free Software Foundation; either
39  * version 2 of the License, or (at your option) any later version.
40  *
41  * This library is distributed in the hope that it will be useful,
42  * but WITHOUT ANY WARRANTY; without even the implied warranty of
43  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
44  * Lesser General Public License for more details.
45  *
46  * You should have received a copy of the GNU Lesser General Public
47  * License along with this library in the file COPYING.LIB;
48  * if not, write to the Free Software Foundation, Inc.,
49  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
50  */
51 
52 #if !defined( SEMAPHORE_H )
53 #define SEMAPHORE_H
54 
55 #if defined(_POSIX_SOURCE)
56 #define PTE_LEVEL 0
57 /* Early POSIX */
58 #endif
59 
60 #if defined(INCLUDE_NP)
61 #undef PTE_LEVEL
62 #define PTE_LEVEL 2
63 /* Include Non-Portable extensions */
64 #endif
65 
66 /*
67  *
68  */
69 
70 #define _POSIX_SEMAPHORES
71 
72 #ifdef __cplusplus
73 extern "C"
74  {
75 #endif /* __cplusplus */
76 
77 
78  typedef struct sem_t_ * sem_t;
79 
80  int sem_init (sem_t * sem,
81  int pshared,
82  unsigned int value);
83 
84  int sem_destroy (sem_t * sem);
85 
86  int sem_trywait (sem_t * sem);
87 
88  int sem_wait (sem_t * sem);
89 
90  int sem_timedwait (sem_t * sem,
91  const struct timespec * abstime);
92 
93  int sem_post (sem_t * sem);
94 
96  int count);
97 
98  int sem_open (const char * name,
99  int oflag,
100  mode_t mode,
101  unsigned int value);
102 
103  int sem_close (sem_t * sem);
104 
105  int sem_unlink (const char * name);
106 
107  int sem_getvalue (sem_t * sem,
108  int * sval);
109 
110 #ifdef __cplusplus
111  } /* End of extern "C" */
112 #endif /* __cplusplus */
113 
114 #endif /* !SEMAPHORE_H */
GLuint const GLchar * name
Definition: glext.h:6671
GLenum mode
Definition: glext.h:6857
GLuint GLuint GLsizei count
Definition: glext.h:6292
struct sem_t_ * sem_t
typedef for the semaphore handle
Definition: semaphore.h:78
int sem_close(sem_t *sem)
Definition: sem.c:130
int sem_post_multiple(sem_t *sem, int count)
Definition: sem.c:470
int sem_getvalue(sem_t *sem, int *sval)
Definition: sem.c:231
int sem_wait(sem_t *sem)
Definition: sem.c:732
int sem_init(sem_t *sem, int pshared, unsigned int value)
Definition: sem.c:291
Definition: implement.h:136
int sem_post(sem_t *sem)
Definition: sem.c:400
int sem_open(const char *name, int oflag, mode_t mode, unsigned int value)
Definition: sem.c:393
GLsizei const GLfloat * value
Definition: glext.h:6709
int sem_trywait(sem_t *sem)
Definition: sem.c:664
int sem_timedwait(sem_t *sem, const struct timespec *abstime)
Definition: sem.c:552
pte_osSemaphoreHandle sem
Definition: implement.h:140
int sem_destroy(sem_t *sem)
Definition: sem.c:136
int sem_unlink(const char *name)
Definition: sem.c:726