1 /* lthread.h - ldap threads header file */
8 #if defined( HAVE_PTHREADS )
9 /**********************************
11 * definitions for POSIX Threads *
13 **********************************/
22 #if defined( HAVE_DCE )
23 #define pthread_attr_init( a ) pthread_attr_create( a )
24 #define pthread_attr_destroy( a ) pthread_attr_delete( a )
25 #define pthread_attr_setdetachstate( a, b ) \
26 pthread_attr_setdetach_np( a, b )
28 #elif !defined(HAVE_PTHREADS_D4)
29 #define pthread_mutexattr_default NULL
30 #define pthread_condattr_default NULL
32 #ifdef HAVE_SCHED_YIELD
33 #define pthread_yield sched_yield
39 #elif defined ( HAVE_MACH_CTHREADS )
40 /**********************************
42 * definitions for Mach CThreads *
44 **********************************/
46 #include <mach/cthreads.h>
50 typedef cthread_fn_t VFP;
51 typedef int pthread_attr_t;
52 typedef cthread_t pthread_t;
54 /* default attr states */
55 #define pthread_mutexattr_default NULL
56 #define pthread_condattr_default NULL
58 /* thread state - joinable or not */
59 #define PTHREAD_CREATE_JOINABLE 0
60 #define PTHREAD_CREATE_DETACHED 1
61 /* thread scope - who is in scheduling pool */
62 #define PTHREAD_SCOPE_PROCESS 0
63 #define PTHREAD_SCOPE_SYSTEM 1
65 /* mutex attributes and mutex type */
66 typedef int pthread_mutexattr_t;
67 typedef struct mutex pthread_mutex_t;
69 /* mutex and condition variable scope - process or system */
70 #define PTHREAD_SHARE_PRIVATE 0
71 #define PTHREAD_SHARE_PROCESS 1
73 /* condition variable attributes and condition variable type */
74 typedef int pthread_condattr_t;
75 typedef struct condition pthread_cond_t;
79 #elif defined( HAVE_THR )
80 /**************************************
82 * thread definitions for Solaris LWP *
84 **************************************/
91 typedef void *(*VFP)();
93 /* default attr states */
94 #define pthread_mutexattr_default NULL
95 #define pthread_condattr_default NULL
97 /* thread state - joinable or not */
98 #define PTHREAD_CREATE_JOINABLE 0
99 #define PTHREAD_CREATE_DETACHED THR_DETACHED
100 /* thread scope - who is in scheduling pool */
101 #define PTHREAD_SCOPE_PROCESS 0
102 #define PTHREAD_SCOPE_SYSTEM THR_BOUND
103 /* mutex and condition variable scope - process or system */
104 #define PTHREAD_SHARE_PRIVATE USYNC_THREAD
105 #define PTHREAD_SHARE_PROCESS USYNC_PROCESS
108 #if !defined(__SunOS_5_6)
109 /* thread attributes and thread type */
110 typedef int pthread_attr_t;
111 typedef thread_t pthread_t;
113 /* mutex attributes and mutex type */
114 typedef int pthread_mutexattr_t;
115 typedef mutex_t pthread_mutex_t;
117 /* condition variable attributes and condition variable type */
118 typedef int pthread_condattr_t;
119 typedef cond_t pthread_cond_t;
120 #endif /* ! sunos56 */
124 #elif defined( HAVE_LWP )
125 /*************************************
127 * thread definitions for SunOS LWP *
129 *************************************/
132 #include <lwp/stackdep.h>
136 typedef void *(*VFP)();
138 /* thread attributes and thread type */
139 typedef int pthread_attr_t;
140 typedef thread_t pthread_t;
142 /* default attr states */
143 #define pthread_mutexattr_default NULL
144 #define pthread_condattr_default NULL
146 /* thread state - joinable or not */
147 #define PTHREAD_CREATE_JOINABLE 0
148 #define PTHREAD_CREATE_DETACHED 1
149 /* thread scope - who is in scheduling pool */
150 #define PTHREAD_SCOPE_PROCESS 0
151 #define PTHREAD_SCOPE_SYSTEM 1
153 /* mutex attributes and mutex type */
154 typedef int pthread_mutexattr_t;
155 typedef mon_t pthread_mutex_t;
157 /* mutex and condition variable scope - process or system */
158 #define PTHREAD_SHARE_PRIVATE 0
159 #define PTHREAD_SHARE_PROCESS 1
161 /* condition variable attributes and condition variable type */
162 typedef int pthread_condattr_t;
163 typedef struct lwpcv {
172 /***********************************
174 * thread definitions for no *
175 * underlying library support *
177 ***********************************/
185 #ifndef PREEMPTIVE_THREADS
186 /* treat no threads as preemptive */
187 #define PREEMPTIVE_THREADS 1
190 typedef void *(*VFP)();
192 /* thread attributes and thread type */
193 typedef int pthread_attr_t;
194 typedef int pthread_t;
196 /* default attr states */
197 #define pthread_mutexattr_default NULL
198 #define pthread_condattr_default NULL
200 /* thread state - joinable or not */
201 #define PTHREAD_CREATE_JOINABLE 0
202 #define PTHREAD_CREATE_DETACHED 0
203 /* thread scope - who is in scheduling pool */
204 #define PTHREAD_SCOPE_PROCESS 0
205 #define PTHREAD_SCOPE_SYSTEM 0
207 /* mutex attributes and mutex type */
208 typedef int pthread_mutexattr_t;
209 typedef int pthread_mutex_t;
211 /* mutex and condition variable scope - process or system */
212 #define PTHREAD_SHARE_PRIVATE 0
213 #define PTHREAD_SHARE_PROCESS 0
215 /* condition variable attributes and condition variable type */
216 typedef int pthread_condattr_t;
217 typedef int pthread_cond_t;
221 #endif /* no threads support */
222 #endif /* _LTHREAD_H */