1 /* lthread.h - ldap threads header file */
10 #if defined ( THREAD_NEXT_CTHREADS )
14 #include <mach/cthreads.h>
16 typedef cthread_fn_t VFP;
17 typedef int pthread_attr_t;
18 typedef cthread_t pthread_t;
20 /* default attr states */
21 #define pthread_mutexattr_default NULL
22 #define pthread_condattr_default NULL
24 /* thread state - joinable or not */
25 #define PTHREAD_CREATE_JOINABLE 0
26 #define PTHREAD_CREATE_DETACHED 1
27 /* thread scope - who is in scheduling pool */
28 #define PTHREAD_SCOPE_PROCESS 0
29 #define PTHREAD_SCOPE_SYSTEM 1
31 /* mutex attributes and mutex type */
32 typedef int pthread_mutexattr_t;
33 typedef struct mutex pthread_mutex_t;
35 /* mutex and condition variable scope - process or system */
36 #define PTHREAD_SHARE_PRIVATE 0
37 #define PTHREAD_SHARE_PROCESS 1
39 /* condition variable attributes and condition variable type */
40 typedef int pthread_condattr_t;
41 typedef struct condition pthread_cond_t;
43 #elif defined( THREAD_SUNOS4_LWP )
44 /***********************************
46 * thread definitions for sunos4 *
48 ***********************************/
53 #include <lwp/stackdep.h>
55 typedef void *(*VFP)();
57 /* thread attributes and thread type */
58 typedef int pthread_attr_t;
59 typedef thread_t pthread_t;
61 /* default attr states */
62 #define pthread_mutexattr_default NULL
63 #define pthread_condattr_default NULL
65 /* thread state - joinable or not */
66 #define PTHREAD_CREATE_JOINABLE 0
67 #define PTHREAD_CREATE_DETACHED 1
68 /* thread scope - who is in scheduling pool */
69 #define PTHREAD_SCOPE_PROCESS 0
70 #define PTHREAD_SCOPE_SYSTEM 1
72 /* mutex attributes and mutex type */
73 typedef int pthread_mutexattr_t;
74 typedef mon_t pthread_mutex_t;
76 /* mutex and condition variable scope - process or system */
77 #define PTHREAD_SHARE_PRIVATE 0
78 #define PTHREAD_SHARE_PROCESS 1
80 /* condition variable attributes and condition variable type */
81 typedef int pthread_condattr_t;
82 typedef struct lwpcv {
87 #else /* end sunos4 */
89 #if defined( THREAD_SUNOS5_LWP )
90 /***********************************
92 * thread definitions for sunos5 *
94 ***********************************/
101 typedef void *(*VFP)();
103 /* sunos5 threads are preemptive */
104 #define PTHREAD_PREEMPTIVE 1
106 #if !defined(__SunOS_5_6)
107 /* thread attributes and thread type */
108 typedef int pthread_attr_t;
109 typedef thread_t pthread_t;
110 #endif /* ! sunos56 */
112 /* default attr states */
113 #define pthread_mutexattr_default NULL
114 #define pthread_condattr_default NULL
116 /* thread state - joinable or not */
117 #define PTHREAD_CREATE_JOINABLE 0
118 #define PTHREAD_CREATE_DETACHED THR_DETACHED
119 /* thread scope - who is in scheduling pool */
120 #define PTHREAD_SCOPE_PROCESS 0
121 #define PTHREAD_SCOPE_SYSTEM THR_BOUND
123 #if !defined(__SunOS_5_6)
124 /* mutex attributes and mutex type */
125 typedef int pthread_mutexattr_t;
126 typedef mutex_t pthread_mutex_t;
127 #endif /* ! sunos56 */
129 /* mutex and condition variable scope - process or system */
130 #define PTHREAD_SHARE_PRIVATE USYNC_THREAD
131 #define PTHREAD_SHARE_PROCESS USYNC_PROCESS
133 #if !defined(__SunOS_5_6)
134 /* condition variable attributes and condition variable type */
135 typedef int pthread_condattr_t;
136 typedef cond_t pthread_cond_t;
137 #endif /* ! sunos56 */
139 #else /* end sunos5 */
141 #if defined( THREAD_MIT_PTHREADS )
142 /***********************************
144 * definitions for mit pthreads *
146 ***********************************/
152 #else /* end mit pthreads */
154 #if defined( THREAD_DCE_PTHREADS )
155 /***********************************
157 * definitions for mit pthreads *
159 ***********************************/
165 /* dce threads are preemptive */
166 #define PTHREAD_PREEMPTIVE 1
168 #define pthread_attr_init( a ) pthread_attr_create( a )
169 #define pthread_attr_destroy( a ) pthread_attr_delete( a )
170 #define pthread_attr_setdetachstate( a, b ) \
171 pthread_attr_setdetach_np( a, b )
173 #else /* end dce pthreads */
175 #if defined( POSIX_THREADS )
181 #define pthread_mutexattr_default NULL
182 #define pthread_condattr_default NULL
184 #endif /* posix threads */
185 #endif /* dce pthreads */
186 #endif /* mit pthreads */
192 /***********************************
194 * thread definitions for no *
195 * underlying library support *
197 ***********************************/
199 typedef void *(*VFP)();
201 /* thread attributes and thread type */
202 typedef int pthread_attr_t;
203 typedef int pthread_t;
205 /* default attr states */
206 #define pthread_mutexattr_default NULL
207 #define pthread_condattr_default NULL
209 /* thread state - joinable or not */
210 #define PTHREAD_CREATE_JOINABLE 0
211 #define PTHREAD_CREATE_DETACHED 0
212 /* thread scope - who is in scheduling pool */
213 #define PTHREAD_SCOPE_PROCESS 0
214 #define PTHREAD_SCOPE_SYSTEM 0
216 /* mutex attributes and mutex type */
217 typedef int pthread_mutexattr_t;
218 typedef int pthread_mutex_t;
220 /* mutex and condition variable scope - process or system */
221 #define PTHREAD_SHARE_PRIVATE 0
222 #define PTHREAD_SHARE_PROCESS 0
224 /* condition variable attributes and condition variable type */
225 typedef int pthread_condattr_t;
226 typedef int pthread_cond_t;
228 #endif /* no threads support */
232 #endif /* _LTHREAD_H */