Only show user-presets in favorite sidebar
[ardour.git] / msvc_extra_headers / ardourext / semaphore.h.input
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-win32 - POSIX Threads Library for Win32
13  *      Copyright(C) 1998 John E. Bossom
14  *      Copyright(C) 1999,2005 Pthreads-win32 contributors
15  * 
16  *      Contact Email: rpj@callisto.canberra.edu.au
17  * 
18  *      The current list of contributors is contained
19  *      in the file CONTRIBUTORS included with the source
20  *      code distribution. The list can also be seen at the
21  *      following World Wide Web location:
22  *      http://sources.redhat.com/pthreads-win32/contributors.html
23  * 
24  *      This library is free software; you can redistribute it and/or
25  *      modify it under the terms of the GNU Lesser General Public
26  *      License as published by the Free Software Foundation; either
27  *      version 2 of the License, or (at your option) any later version.
28  * 
29  *      This library is distributed in the hope that it will be useful,
30  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
31  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
32  *      Lesser General Public License for more details.
33  * 
34  *      You should have received a copy of the GNU Lesser General Public
35  *      License along with this library in the file COPYING.LIB;
36  *      if not, write to the Free Software Foundation, Inc.,
37  *      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
38  */
39 #if !defined( SEMAPHORE_H )
40 #ifdef  _SEMAPHORE_H  // Test added by JE - 12-12-2009
41 #error  "ardourext/semaphore.h conflicts with an existing pthread library"
42 #endif
43 // Now make sure we can't accidentally include a conflicting library !!
44 #define _SEMAPHORE_H
45 #define SEMAPHORE_H
46
47 #undef PTW32_LEVEL
48
49 #if defined(_POSIX_SOURCE)
50 #define PTW32_LEVEL 0
51 /* Early POSIX */
52 #endif
53
54 #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
55 #undef PTW32_LEVEL
56 #define PTW32_LEVEL 1
57 /* Include 1b, 1c and 1d */
58 #endif
59
60 #if defined(INCLUDE_NP)
61 #undef PTW32_LEVEL
62 #define PTW32_LEVEL 2
63 /* Include Non-Portable extensions */
64 #endif
65
66 #define PTW32_LEVEL_MAX 3
67
68 #if !defined(PTW32_LEVEL)
69 #define PTW32_LEVEL PTW32_LEVEL_MAX
70 /* Include everything */
71 #endif
72
73 #if __GNUC__ && ! defined (__declspec)
74 # error Please upgrade your GNU compiler to one that supports __declspec.
75 #endif
76
77 /*
78  * When building the DLL code, you should define PTW32_BUILD so that
79  * the variables/functions are exported correctly. When using the DLL,
80  * do NOT define PTW32_BUILD, and then the variables/functions will
81  * be imported correctly.
82  */
83 #ifndef PTW32_STATIC_LIB
84 #  ifdef PTW32_BUILD
85 #    define PTW32_DLLPORT __declspec (dllexport)
86 #  else
87 #    define PTW32_DLLPORT __declspec (dllimport)
88 #  endif
89 #else
90 #  define PTW32_DLLPORT
91 #endif
92
93 /*
94  * This is a duplicate of what is in the autoconf config.h,
95  * which is only used when building the pthread-win32 libraries.
96  */
97
98 #ifndef PTW32_CONFIG_H
99 #  if defined(WINCE)
100 #    define NEED_ERRNO
101 #    define NEED_SEM
102 #  endif
103 #  if defined(_UWIN) || defined(__MINGW32__)
104 #    define HAVE_MODE_T
105 #  endif
106 #endif
107
108 /*
109  *
110  */
111
112 #if PTW32_LEVEL >= PTW32_LEVEL_MAX
113 #ifdef NEED_ERRNO
114 #include "need_errno.h"
115 #else
116 #include <errno.h>
117 #endif
118 #endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
119
120 #define _POSIX_SEMAPHORES
121
122 #ifdef __cplusplus
123 extern "C"
124 {
125 #endif                          /* __cplusplus */
126
127 #ifndef HAVE_MODE_T
128 typedef unsigned int mode_t;
129 #endif
130
131
132 typedef struct sem_t_ * sem_t;
133
134 PTW32_DLLPORT int __cdecl sem_init (sem_t * sem,
135                             int pshared,
136                             unsigned int value);
137
138 PTW32_DLLPORT int __cdecl sem_destroy (sem_t * sem);
139
140 PTW32_DLLPORT int __cdecl sem_trywait (sem_t * sem);
141
142 PTW32_DLLPORT int __cdecl sem_wait (sem_t * sem);
143
144 PTW32_DLLPORT int __cdecl sem_timedwait (sem_t * sem,
145                                  const struct timespec * abstime);
146
147 PTW32_DLLPORT int __cdecl sem_post (sem_t * sem);
148
149 PTW32_DLLPORT int __cdecl sem_post_multiple (sem_t * sem,
150                                      int count);
151
152 PTW32_DLLPORT int __cdecl sem_open (const char * name,
153                             int oflag,
154                             mode_t mode,
155                             unsigned int value);
156
157 PTW32_DLLPORT int __cdecl sem_close (sem_t * sem);
158
159 PTW32_DLLPORT int __cdecl sem_unlink (const char * name);
160
161 PTW32_DLLPORT int __cdecl sem_getvalue (sem_t * sem,
162                                 int * sval);
163
164 #ifdef __cplusplus
165 }                               /* End of extern "C" */
166 #endif                          /* __cplusplus */
167
168 #undef PTW32_LEVEL
169 #undef PTW32_LEVEL_MAX
170
171 #endif                          /* !SEMAPHORE_H */