lthread.h 5.55 KB
Newer Older
Kurt Zeilenga's avatar
Kurt Zeilenga committed
1
2
3
4
5
/* lthread.h - ldap threads header file */

#ifndef _LTHREAD_H
#define _LTHREAD_H

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#if defined ( THREAD_NEXT_CTHREADS )

#define _THREAD

#include <mach/cthreads.h>

typedef cthread_fn_t	VFP;
typedef int		pthread_attr_t;
typedef cthread_t	pthread_t;

/* default attr states */
#define pthread_mutexattr_default	NULL
#define pthread_condattr_default	NULL

/* thread state - joinable or not */
#define PTHREAD_CREATE_JOINABLE	0
#define PTHREAD_CREATE_DETACHED	1
/* thread scope - who is in scheduling pool */
#define PTHREAD_SCOPE_PROCESS	0
#define PTHREAD_SCOPE_SYSTEM	1

/* mutex attributes and mutex type */
typedef int	pthread_mutexattr_t;
typedef struct mutex pthread_mutex_t;

/* mutex and condition variable scope - process or system */
#define PTHREAD_SHARE_PRIVATE	0
#define PTHREAD_SHARE_PROCESS	1

/* condition variable attributes and condition variable type */
typedef int	pthread_condattr_t;
typedef struct condition pthread_cond_t;

#elif defined( THREAD_SUNOS4_LWP )
Kurt Zeilenga's avatar
Kurt Zeilenga committed
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/***********************************
 *                                 *
 * thread definitions for sunos4   *
 *                                 *
 ***********************************/

#define _THREAD

#include <lwp/lwp.h>
#include <lwp/stackdep.h>

typedef void	*(*VFP)();

/* thread attributes and thread type */
typedef int		pthread_attr_t;
typedef thread_t	pthread_t;

/* default attr states */
#define pthread_mutexattr_default	NULL
#define pthread_condattr_default	NULL

/* thread state - joinable or not */
#define PTHREAD_CREATE_JOINABLE	0
#define PTHREAD_CREATE_DETACHED	1
/* thread scope - who is in scheduling pool */
#define PTHREAD_SCOPE_PROCESS	0
#define PTHREAD_SCOPE_SYSTEM	1

/* mutex attributes and mutex type */
typedef int	pthread_mutexattr_t;
typedef mon_t	pthread_mutex_t;

/* mutex and condition variable scope - process or system */
#define PTHREAD_SHARE_PRIVATE	0
#define PTHREAD_SHARE_PROCESS	1

/* condition variable attributes and condition variable type */
typedef int	pthread_condattr_t;
typedef struct lwpcv {
	int		lcv_created;
	cv_t		lcv_cv;
} pthread_cond_t;

#else /* end sunos4 */

#if defined( THREAD_SUNOS5_LWP )
/***********************************
 *                                 *
 * thread definitions for sunos5   *
 *                                 *
 ***********************************/

#define _THREAD

#include <thread.h>
#include <synch.h>

typedef void	*(*VFP)();

/* sunos5 threads are preemptive */
#define PTHREAD_PREEMPTIVE	1

102
#if !defined(__SunOS_5_6)
Kurt Zeilenga's avatar
Kurt Zeilenga committed
103
104
105
/* thread attributes and thread type */
typedef int		pthread_attr_t;
typedef thread_t	pthread_t;
106
#endif /* ! sunos56 */
Kurt Zeilenga's avatar
Kurt Zeilenga committed
107
108
109
110
111
112
113
114
115
116
117
118

/* default attr states */
#define pthread_mutexattr_default	NULL
#define pthread_condattr_default	NULL

/* thread state - joinable or not */
#define PTHREAD_CREATE_JOINABLE 0
#define PTHREAD_CREATE_DETACHED THR_DETACHED
/* thread scope - who is in scheduling pool */
#define PTHREAD_SCOPE_PROCESS   0
#define PTHREAD_SCOPE_SYSTEM    THR_BOUND

119
#if !defined(__SunOS_5_6)
Kurt Zeilenga's avatar
Kurt Zeilenga committed
120
121
122
/* mutex attributes and mutex type */
typedef int	pthread_mutexattr_t;
typedef mutex_t	pthread_mutex_t;
123
#endif /* ! sunos56 */
Kurt Zeilenga's avatar
Kurt Zeilenga committed
124
125
126
127
128

/* mutex and condition variable scope - process or system */
#define PTHREAD_SHARE_PRIVATE   USYNC_THREAD
#define PTHREAD_SHARE_PROCESS   USYNC_PROCESS

129
#if !defined(__SunOS_5_6)
Kurt Zeilenga's avatar
Kurt Zeilenga committed
130
131
132
/* condition variable attributes and condition variable type */
typedef int     pthread_condattr_t;
typedef cond_t	pthread_cond_t;
133
#endif /* ! sunos56 */
Kurt Zeilenga's avatar
Kurt Zeilenga committed
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166

#else /* end sunos5 */

#if defined( THREAD_MIT_PTHREADS )
/***********************************
 *                                 *
 * definitions for mit pthreads    *
 *                                 *
 ***********************************/

#define _THREAD

#include <pthread.h>

#else /* end mit pthreads */

#if defined( THREAD_DCE_PTHREADS )
/***********************************
 *                                 *
 * definitions for mit pthreads    *
 *                                 *
 ***********************************/

#define _THREAD

#include <pthread.h>

/* dce threads are preemptive */
#define PTHREAD_PREEMPTIVE	1

#define pthread_attr_init( a )		pthread_attr_create( a )
#define pthread_attr_destroy( a )	pthread_attr_delete( a )
#define pthread_attr_setdetachstate( a, b ) \
167
					pthread_attr_setdetach_np( (a), (b) )
Kurt Zeilenga's avatar
Kurt Zeilenga committed
168

169
170
171
172
173
174
175
176
177
178
179
180
#else /* end dce pthreads */

#if defined( POSIX_THREADS )

#define _THREAD

#include <pthread.h>

#define pthread_mutexattr_default	NULL
#define pthread_condattr_default	NULL

#endif /* posix threads */
Kurt Zeilenga's avatar
Kurt Zeilenga committed
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
#endif /* dce pthreads */
#endif /* mit pthreads */
#endif /* sunos5 */
#endif /* sunos4 */

#ifndef _THREAD

/***********************************
 *                                 *
 * thread definitions for no       *
 * underlying library support      *
 *                                 *
 ***********************************/

typedef void	*(*VFP)();

/* thread attributes and thread type */
typedef int	pthread_attr_t;
typedef int	pthread_t;

/* default attr states */
#define pthread_mutexattr_default	NULL
#define pthread_condattr_default	NULL

/* thread state - joinable or not */
#define PTHREAD_CREATE_JOINABLE 0
#define PTHREAD_CREATE_DETACHED 0
/* thread scope - who is in scheduling pool */
#define PTHREAD_SCOPE_PROCESS   0
#define PTHREAD_SCOPE_SYSTEM    0

/* mutex attributes and mutex type */
typedef int	pthread_mutexattr_t;
typedef int	pthread_mutex_t;

/* mutex and condition variable scope - process or system */
#define PTHREAD_SHARE_PRIVATE   0
#define PTHREAD_SHARE_PROCESS   0

/* condition variable attributes and condition variable type */
typedef int     pthread_condattr_t;
typedef int	pthread_cond_t;

#endif /* no threads support */
#endif /* _LTHREAD_H */