1 /* lthread.h - ldap threads header file */
6 #if defined ( THREAD_NEXT_CTHREADS )
10 #include <mach/cthreads.h>
12 typedef cthread_fn_t VFP;
13 typedef int pthread_attr_t;
14 typedef cthread_t pthread_t;
16 /* default attr states */
17 #define pthread_mutexattr_default NULL
18 #define pthread_condattr_default NULL
20 /* thread state - joinable or not */
21 #define PTHREAD_CREATE_JOINABLE 0
22 #define PTHREAD_CREATE_DETACHED 1
23 /* thread scope - who is in scheduling pool */
24 #define PTHREAD_SCOPE_PROCESS 0
25 #define PTHREAD_SCOPE_SYSTEM 1
27 /* mutex attributes and mutex type */
28 typedef int pthread_mutexattr_t;
29 typedef struct mutex pthread_mutex_t;
31 /* mutex and condition variable scope - process or system */
32 #define PTHREAD_SHARE_PRIVATE 0
33 #define PTHREAD_SHARE_PROCESS 1
35 /* condition variable attributes and condition variable type */
36 typedef int pthread_condattr_t;
37 typedef struct condition pthread_cond_t;
39 #elif defined( THREAD_SUNOS4_LWP )
40 /***********************************
42 * thread definitions for sunos4 *
44 ***********************************/
49 #include <lwp/stackdep.h>
51 typedef void *(*VFP)();
53 /* thread attributes and thread type */
54 typedef int pthread_attr_t;
55 typedef thread_t pthread_t;
57 /* default attr states */
58 #define pthread_mutexattr_default NULL
59 #define pthread_condattr_default NULL
61 /* thread state - joinable or not */
62 #define PTHREAD_CREATE_JOINABLE 0
63 #define PTHREAD_CREATE_DETACHED 1
64 /* thread scope - who is in scheduling pool */
65 #define PTHREAD_SCOPE_PROCESS 0
66 #define PTHREAD_SCOPE_SYSTEM 1
68 /* mutex attributes and mutex type */
69 typedef int pthread_mutexattr_t;
70 typedef mon_t pthread_mutex_t;
72 /* mutex and condition variable scope - process or system */
73 #define PTHREAD_SHARE_PRIVATE 0
74 #define PTHREAD_SHARE_PROCESS 1
76 /* condition variable attributes and condition variable type */
77 typedef int pthread_condattr_t;
78 typedef struct lwpcv {
83 #else /* end sunos4 */
85 #if defined( THREAD_SUNOS5_LWP )
86 /***********************************
88 * thread definitions for sunos5 *
90 ***********************************/
97 typedef void *(*VFP)();
99 /* sunos5 threads are preemptive */
100 #define PTHREAD_PREEMPTIVE 1
102 #if !defined(__SunOS_5_6)
103 /* thread attributes and thread type */
104 typedef int pthread_attr_t;
105 typedef thread_t pthread_t;
106 #endif /* ! sunos56 */
108 /* default attr states */
109 #define pthread_mutexattr_default NULL
110 #define pthread_condattr_default NULL
112 /* thread state - joinable or not */
113 #define PTHREAD_CREATE_JOINABLE 0
114 #define PTHREAD_CREATE_DETACHED THR_DETACHED
115 /* thread scope - who is in scheduling pool */
116 #define PTHREAD_SCOPE_PROCESS 0
117 #define PTHREAD_SCOPE_SYSTEM THR_BOUND
119 #if !defined(__SunOS_5_6)
120 /* mutex attributes and mutex type */
121 typedef int pthread_mutexattr_t;
122 typedef mutex_t pthread_mutex_t;
123 #endif /* ! sunos56 */
125 /* mutex and condition variable scope - process or system */
126 #define PTHREAD_SHARE_PRIVATE USYNC_THREAD
127 #define PTHREAD_SHARE_PROCESS USYNC_PROCESS
129 #if !defined(__SunOS_5_6)
130 /* condition variable attributes and condition variable type */
131 typedef int pthread_condattr_t;
132 typedef cond_t pthread_cond_t;
133 #endif /* ! sunos56 */
135 #else /* end sunos5 */
137 #if defined( THREAD_MIT_PTHREADS )
138 /***********************************
140 * definitions for mit pthreads *
142 ***********************************/
148 #else /* end mit pthreads */
150 #if defined( THREAD_DCE_PTHREADS )
151 /***********************************
153 * definitions for mit pthreads *
155 ***********************************/
161 /* dce threads are preemptive */
162 #define PTHREAD_PREEMPTIVE 1
164 #define pthread_attr_init( a ) pthread_attr_create( a )
165 #define pthread_attr_destroy( a ) pthread_attr_delete( a )
166 #define pthread_attr_setdetachstate( a, b ) \
167 pthread_attr_setdetach_np( a, b )
169 #else /* end dce pthreads */
171 #if defined( POSIX_THREADS )
178 #define pthread_mutexattr_default NULL
179 #define pthread_condattr_default NULL
181 #endif /* posix threads */
182 #endif /* dce pthreads */
183 #endif /* mit pthreads */
189 /***********************************
191 * thread definitions for no *
192 * underlying library support *
194 ***********************************/
196 typedef void *(*VFP)();
198 /* thread attributes and thread type */
199 typedef int pthread_attr_t;
200 typedef int pthread_t;
202 /* default attr states */
203 #define pthread_mutexattr_default NULL
204 #define pthread_condattr_default NULL
206 /* thread state - joinable or not */
207 #define PTHREAD_CREATE_JOINABLE 0
208 #define PTHREAD_CREATE_DETACHED 0
209 /* thread scope - who is in scheduling pool */
210 #define PTHREAD_SCOPE_PROCESS 0
211 #define PTHREAD_SCOPE_SYSTEM 0
213 /* mutex attributes and mutex type */
214 typedef int pthread_mutexattr_t;
215 typedef int pthread_mutex_t;
217 /* mutex and condition variable scope - process or system */
218 #define PTHREAD_SHARE_PRIVATE 0
219 #define PTHREAD_SHARE_PROCESS 0
221 /* condition variable attributes and condition variable type */
222 typedef int pthread_condattr_t;
223 typedef int pthread_cond_t;
225 #endif /* no threads support */
226 #endif /* _LTHREAD_H */