]> git.sur5r.net Git - openldap/blob - include/lthread.h
Fix abstract oc check
[openldap] / include / lthread.h
1 /* lthread.h - ldap threads header file */
2
3 #ifndef _LTHREAD_H
4 #define _LTHREAD_H
5
6 #if defined( THREAD_SUNOS4_LWP )
7 /***********************************
8  *                                 *
9  * thread definitions for sunos4   *
10  *                                 *
11  ***********************************/
12
13 #define _THREAD
14
15 #include <lwp/lwp.h>
16 #include <lwp/stackdep.h>
17
18 typedef void    *(*VFP)();
19
20 /* thread attributes and thread type */
21 typedef int             pthread_attr_t;
22 typedef thread_t        pthread_t;
23
24 /* default attr states */
25 #define pthread_mutexattr_default       NULL
26 #define pthread_condattr_default        NULL
27
28 /* thread state - joinable or not */
29 #define PTHREAD_CREATE_JOINABLE 0
30 #define PTHREAD_CREATE_DETACHED 1
31 /* thread scope - who is in scheduling pool */
32 #define PTHREAD_SCOPE_PROCESS   0
33 #define PTHREAD_SCOPE_SYSTEM    1
34
35 /* mutex attributes and mutex type */
36 typedef int     pthread_mutexattr_t;
37 typedef mon_t   pthread_mutex_t;
38
39 /* mutex and condition variable scope - process or system */
40 #define PTHREAD_SHARE_PRIVATE   0
41 #define PTHREAD_SHARE_PROCESS   1
42
43 /* condition variable attributes and condition variable type */
44 typedef int     pthread_condattr_t;
45 typedef struct lwpcv {
46         int             lcv_created;
47         cv_t            lcv_cv;
48 } pthread_cond_t;
49
50 #else /* end sunos4 */
51
52 #if defined( THREAD_SUNOS5_LWP )
53 /***********************************
54  *                                 *
55  * thread definitions for sunos5   *
56  *                                 *
57  ***********************************/
58
59 #define _THREAD
60
61 #include <thread.h>
62 #include <synch.h>
63
64 typedef void    *(*VFP)();
65
66 /* sunos5 threads are preemptive */
67 #define PTHREAD_PREEMPTIVE      1
68
69 /* thread attributes and thread type */
70 typedef int             pthread_attr_t;
71 typedef thread_t        pthread_t;
72
73 /* default attr states */
74 #define pthread_mutexattr_default       NULL
75 #define pthread_condattr_default        NULL
76
77 /* thread state - joinable or not */
78 #define PTHREAD_CREATE_JOINABLE 0
79 #define PTHREAD_CREATE_DETACHED THR_DETACHED
80 /* thread scope - who is in scheduling pool */
81 #define PTHREAD_SCOPE_PROCESS   0
82 #define PTHREAD_SCOPE_SYSTEM    THR_BOUND
83
84 /* mutex attributes and mutex type */
85 typedef int     pthread_mutexattr_t;
86 typedef mutex_t pthread_mutex_t;
87
88 /* mutex and condition variable scope - process or system */
89 #define PTHREAD_SHARE_PRIVATE   USYNC_THREAD
90 #define PTHREAD_SHARE_PROCESS   USYNC_PROCESS
91
92 /* condition variable attributes and condition variable type */
93 typedef int     pthread_condattr_t;
94 typedef cond_t  pthread_cond_t;
95
96 #else /* end sunos5 */
97
98 #if defined( THREAD_MIT_PTHREADS )
99 /***********************************
100  *                                 *
101  * definitions for mit pthreads    *
102  *                                 *
103  ***********************************/
104
105 #define _THREAD
106
107 #include <pthread.h>
108
109 #else /* end mit pthreads */
110
111 #if defined( THREAD_DCE_PTHREADS )
112 /***********************************
113  *                                 *
114  * definitions for mit pthreads    *
115  *                                 *
116  ***********************************/
117
118 #define _THREAD
119
120 #include <pthread.h>
121
122 /* dce threads are preemptive */
123 #define PTHREAD_PREEMPTIVE      1
124
125 #define pthread_attr_init( a )          pthread_attr_create( a )
126 #define pthread_attr_destroy( a )       pthread_attr_delete( a )
127 #define pthread_attr_setdetachstate( a, b ) \
128                                         pthread_attr_setdetach_np( a, b )
129
130 #endif /* dce pthreads */
131 #endif /* mit pthreads */
132 #endif /* sunos5 */
133 #endif /* sunos4 */
134
135 #ifndef _THREAD
136
137 /***********************************
138  *                                 *
139  * thread definitions for no       *
140  * underlying library support      *
141  *                                 *
142  ***********************************/
143
144 typedef void    *(*VFP)();
145
146 /* thread attributes and thread type */
147 typedef int     pthread_attr_t;
148 typedef int     pthread_t;
149
150 /* default attr states */
151 #define pthread_mutexattr_default       NULL
152 #define pthread_condattr_default        NULL
153
154 /* thread state - joinable or not */
155 #define PTHREAD_CREATE_JOINABLE 0
156 #define PTHREAD_CREATE_DETACHED 0
157 /* thread scope - who is in scheduling pool */
158 #define PTHREAD_SCOPE_PROCESS   0
159 #define PTHREAD_SCOPE_SYSTEM    0
160
161 /* mutex attributes and mutex type */
162 typedef int     pthread_mutexattr_t;
163 typedef int     pthread_mutex_t;
164
165 /* mutex and condition variable scope - process or system */
166 #define PTHREAD_SHARE_PRIVATE   0
167 #define PTHREAD_SHARE_PROCESS   0
168
169 /* condition variable attributes and condition variable type */
170 typedef int     pthread_condattr_t;
171 typedef int     pthread_cond_t;
172
173 #endif /* no threads support */
174 #endif /* _LTHREAD_H */