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 /* dce threads are preemptive */
25 #define pthread_attr_init( a ) pthread_attr_create( a )
26 #define pthread_attr_destroy( a ) pthread_attr_delete( a )
27 #define pthread_attr_setdetachstate( a, b ) \
28 pthread_attr_setdetach_np( a, b )
30 #elif !defined(HAVE_PTHREADS_D4)
31 #define pthread_mutexattr_default NULL
32 #define pthread_condattr_default NULL
34 #ifdef HAVE_SCHED_YIELD
35 #define pthread_yield sched_yield
41 #elif defined ( HAVE_MACH_CTHREADS )
42 /**********************************
44 * definitions for Mach CThreads *
46 **********************************/
48 #include <mach/cthreads.h>
52 typedef cthread_fn_t VFP;
53 typedef int pthread_attr_t;
54 typedef cthread_t pthread_t;
56 /* default attr states */
57 #define pthread_mutexattr_default NULL
58 #define pthread_condattr_default NULL
60 /* thread state - joinable or not */
61 #define PTHREAD_CREATE_JOINABLE 0
62 #define PTHREAD_CREATE_DETACHED 1
63 /* thread scope - who is in scheduling pool */
64 #define PTHREAD_SCOPE_PROCESS 0
65 #define PTHREAD_SCOPE_SYSTEM 1
67 /* mutex attributes and mutex type */
68 typedef int pthread_mutexattr_t;
69 typedef struct mutex pthread_mutex_t;
71 /* mutex and condition variable scope - process or system */
72 #define PTHREAD_SHARE_PRIVATE 0
73 #define PTHREAD_SHARE_PROCESS 1
75 /* condition variable attributes and condition variable type */
76 typedef int pthread_condattr_t;
77 typedef struct condition pthread_cond_t;
81 #elif defined( HAVE_LWP_THR )
82 /**************************************
84 * thread definitions for Solaris LWP *
86 **************************************/
93 typedef void *(*VFP)();
95 /* default attr states */
96 #define pthread_mutexattr_default NULL
97 #define pthread_condattr_default NULL
99 /* thread state - joinable or not */
100 #define PTHREAD_CREATE_JOINABLE 0
101 #define PTHREAD_CREATE_DETACHED THR_DETACHED
102 /* thread scope - who is in scheduling pool */
103 #define PTHREAD_SCOPE_PROCESS 0
104 #define PTHREAD_SCOPE_SYSTEM THR_BOUND
105 /* mutex and condition variable scope - process or system */
106 #define PTHREAD_SHARE_PRIVATE USYNC_THREAD
107 #define PTHREAD_SHARE_PROCESS USYNC_PROCESS
110 #if !defined(__SunOS_5_6)
111 /* thread attributes and thread type */
112 typedef int pthread_attr_t;
113 typedef thread_t pthread_t;
115 /* mutex attributes and mutex type */
116 typedef int pthread_mutexattr_t;
117 typedef mutex_t pthread_mutex_t;
119 /* condition variable attributes and condition variable type */
120 typedef int pthread_condattr_t;
121 typedef cond_t pthread_cond_t;
122 #endif /* ! sunos56 */
126 #elif defined( HAVE_LWP )
127 /*************************************
129 * thread definitions for SunOS LWP *
131 *************************************/
134 #include <lwp/stackdep.h>
138 typedef void *(*VFP)();
140 /* thread attributes and thread type */
141 typedef int pthread_attr_t;
142 typedef thread_t pthread_t;
144 /* default attr states */
145 #define pthread_mutexattr_default NULL
146 #define pthread_condattr_default NULL
148 /* thread state - joinable or not */
149 #define PTHREAD_CREATE_JOINABLE 0
150 #define PTHREAD_CREATE_DETACHED 1
151 /* thread scope - who is in scheduling pool */
152 #define PTHREAD_SCOPE_PROCESS 0
153 #define PTHREAD_SCOPE_SYSTEM 1
155 /* mutex attributes and mutex type */
156 typedef int pthread_mutexattr_t;
157 typedef mon_t pthread_mutex_t;
159 /* mutex and condition variable scope - process or system */
160 #define PTHREAD_SHARE_PRIVATE 0
161 #define PTHREAD_SHARE_PROCESS 1
163 /* condition variable attributes and condition variable type */
164 typedef int pthread_condattr_t;
165 typedef struct lwpcv {
174 /***********************************
176 * thread definitions for no *
177 * underlying library support *
179 ***********************************/
183 typedef void *(*VFP)();
185 /* thread attributes and thread type */
186 typedef int pthread_attr_t;
187 typedef int pthread_t;
189 /* default attr states */
190 #define pthread_mutexattr_default NULL
191 #define pthread_condattr_default NULL
193 /* thread state - joinable or not */
194 #define PTHREAD_CREATE_JOINABLE 0
195 #define PTHREAD_CREATE_DETACHED 0
196 /* thread scope - who is in scheduling pool */
197 #define PTHREAD_SCOPE_PROCESS 0
198 #define PTHREAD_SCOPE_SYSTEM 0
200 /* mutex attributes and mutex type */
201 typedef int pthread_mutexattr_t;
202 typedef int pthread_mutex_t;
204 /* mutex and condition variable scope - process or system */
205 #define PTHREAD_SHARE_PRIVATE 0
206 #define PTHREAD_SHARE_PROCESS 0
208 /* condition variable attributes and condition variable type */
209 typedef int pthread_condattr_t;
210 typedef int pthread_cond_t;
214 #endif /* no threads support */
215 #endif /* _LTHREAD_H */