1 /* lthread.h - ldap threads header file */
8 #if defined( HAVE_PTHREADS )
9 /**********************************
11 * definitions for POSIX Threads *
13 **********************************/
22 #if !defined( HAVE_FUNC_PTHREAD_ATTR_INIT ) && \
23 defined( HAVE_FUNC_PTHREAD_ATTR_CREATE )
24 #define pthread_attr_init( a ) pthread_attr_create( a )
27 #if !defined( HAVE_FUNC_PTHREAD_ATTR_DESTROY ) && \
28 defined( HAVE_FUNC_PTHREAD_ATTR_DELETE )
29 #define pthread_attr_destroy( a ) pthread_attr_delete( a )
32 #if !defined( HAVE_FUNC_PTHREAD_ATTR_SETDETACHSTATE ) && \
33 defined( HAVE_FUNC_PTHREAD_ATTR_SETDETACHSTATE_NP )
34 #define pthread_attr_setdetachstate( a, b ) \
35 pthread_attr_setdetach_np( a, b )
38 #ifndef HAVE_PTHREADS_D4
39 #define pthread_mutexattr_default NULL
40 #define pthread_condattr_default NULL
42 #ifdef HAVE_SCHED_YIELD
43 #define pthread_yield sched_yield
49 #elif defined ( HAVE_MACH_CTHREADS )
50 /**********************************
52 * definitions for Mach CThreads *
54 **********************************/
56 #include <mach/cthreads.h>
60 typedef cthread_fn_t VFP;
61 typedef int pthread_attr_t;
62 typedef cthread_t pthread_t;
64 /* default attr states */
65 #define pthread_mutexattr_default NULL
66 #define pthread_condattr_default NULL
68 /* thread state - joinable or not */
69 #define PTHREAD_CREATE_JOINABLE 0
70 #define PTHREAD_CREATE_DETACHED 1
71 /* thread scope - who is in scheduling pool */
72 #define PTHREAD_SCOPE_PROCESS 0
73 #define PTHREAD_SCOPE_SYSTEM 1
75 /* mutex attributes and mutex type */
76 typedef int pthread_mutexattr_t;
77 typedef struct mutex pthread_mutex_t;
79 /* mutex and condition variable scope - process or system */
80 #define PTHREAD_SHARE_PRIVATE 0
81 #define PTHREAD_SHARE_PROCESS 1
83 /* condition variable attributes and condition variable type */
84 typedef int pthread_condattr_t;
85 typedef struct condition pthread_cond_t;
89 #elif defined( HAVE_THR )
90 /**************************************
92 * thread definitions for Solaris LWP *
94 **************************************/
101 typedef void *(*VFP)();
103 /* default attr states */
104 #define pthread_mutexattr_default NULL
105 #define pthread_condattr_default NULL
107 /* thread state - joinable or not */
108 #define PTHREAD_CREATE_JOINABLE 0
109 #define PTHREAD_CREATE_DETACHED THR_DETACHED
110 /* thread scope - who is in scheduling pool */
111 #define PTHREAD_SCOPE_PROCESS 0
112 #define PTHREAD_SCOPE_SYSTEM THR_BOUND
113 /* mutex and condition variable scope - process or system */
114 #define PTHREAD_SHARE_PRIVATE USYNC_THREAD
115 #define PTHREAD_SHARE_PROCESS USYNC_PROCESS
118 #if !defined(__SunOS_5_6)
119 /* thread attributes and thread type */
120 typedef int pthread_attr_t;
121 typedef thread_t pthread_t;
123 /* mutex attributes and mutex type */
124 typedef int pthread_mutexattr_t;
125 typedef mutex_t pthread_mutex_t;
127 /* condition variable attributes and condition variable type */
128 typedef int pthread_condattr_t;
129 typedef cond_t pthread_cond_t;
130 #endif /* ! sunos56 */
134 #elif defined( HAVE_LWP )
135 /*************************************
137 * thread definitions for SunOS LWP *
139 *************************************/
142 #include <lwp/stackdep.h>
146 typedef void *(*VFP)();
148 /* thread attributes and thread type */
149 typedef int pthread_attr_t;
150 typedef thread_t pthread_t;
152 /* default attr states */
153 #define pthread_mutexattr_default NULL
154 #define pthread_condattr_default NULL
156 /* thread state - joinable or not */
157 #define PTHREAD_CREATE_JOINABLE 0
158 #define PTHREAD_CREATE_DETACHED 1
159 /* thread scope - who is in scheduling pool */
160 #define PTHREAD_SCOPE_PROCESS 0
161 #define PTHREAD_SCOPE_SYSTEM 1
163 /* mutex attributes and mutex type */
164 typedef int pthread_mutexattr_t;
165 typedef mon_t pthread_mutex_t;
167 /* mutex and condition variable scope - process or system */
168 #define PTHREAD_SHARE_PRIVATE 0
169 #define PTHREAD_SHARE_PROCESS 1
171 /* condition variable attributes and condition variable type */
172 typedef int pthread_condattr_t;
173 typedef struct lwpcv {
182 /***********************************
184 * thread definitions for no *
185 * underlying library support *
187 ***********************************/
195 #ifndef PREEMPTIVE_THREADS
196 /* treat no threads as preemptive */
197 #define PREEMPTIVE_THREADS 1
200 typedef void *(*VFP)();
202 /* thread attributes and thread type */
203 typedef int pthread_attr_t;
204 typedef int pthread_t;
206 /* default attr states */
207 #define pthread_mutexattr_default NULL
208 #define pthread_condattr_default NULL
210 /* thread state - joinable or not */
211 #define PTHREAD_CREATE_JOINABLE 0
212 #define PTHREAD_CREATE_DETACHED 0
213 /* thread scope - who is in scheduling pool */
214 #define PTHREAD_SCOPE_PROCESS 0
215 #define PTHREAD_SCOPE_SYSTEM 0
217 /* mutex attributes and mutex type */
218 typedef int pthread_mutexattr_t;
219 typedef int pthread_mutex_t;
221 /* mutex and condition variable scope - process or system */
222 #define PTHREAD_SHARE_PRIVATE 0
223 #define PTHREAD_SHARE_PROCESS 0
225 /* condition variable attributes and condition variable type */
226 typedef int pthread_condattr_t;
227 typedef int pthread_cond_t;
231 #endif /* no threads support */
232 #endif /* _LTHREAD_H */