@@ -31,19 +31,9 @@ extern "C" {
31
31
#define EXTERNC
32
32
#endif /* __cplusplus */
33
33
34
- #if defined(__WIN__) || defined(OS2)
34
+ #if defined(__WIN__)
35
35
36
- #ifdef OS2
37
- typedef ULONG HANDLE ;
38
- typedef ULONG DWORD ;
39
- typedef int sigset_t ;
40
- #endif
41
-
42
- #ifdef OS2
43
- typedef HMTX pthread_mutex_t ;
44
- #else
45
36
typedef CRITICAL_SECTION pthread_mutex_t ;
46
- #endif
47
37
typedef HANDLE pthread_t ;
48
38
typedef struct thread_attr {
49
39
DWORD dwStackSize ;
@@ -62,30 +52,19 @@ typedef struct st_pthread_link {
62
52
63
53
typedef struct {
64
54
uint32 waiting ;
65
- #ifdef OS2
66
- HEV semaphore ;
67
- #else
68
55
HANDLE semaphore ;
69
- #endif
70
56
} pthread_cond_t ;
71
57
72
58
73
- #ifndef OS2
74
59
struct timespec { /* For pthread_cond_timedwait() */
75
60
time_t tv_sec ;
76
61
long tv_nsec ;
77
62
};
78
- #endif
79
63
80
64
typedef int pthread_mutexattr_t ;
81
65
#define win_pthread_self my_thread_var->pthread_self
82
- #ifdef OS2
83
- #define pthread_handler_t EXTERNC void * _Optlink
84
- typedef void * (_Optlink * pthread_handler )(void * );
85
- #else
86
66
#define pthread_handler_t EXTERNC void * __cdecl
87
67
typedef void * (__cdecl * pthread_handler )(void * );
88
- #endif
89
68
90
69
void win_pthread_init (void );
91
70
int win_pthread_setspecific (void * A ,void * B ,uint length );
@@ -107,10 +86,8 @@ struct tm *gmtime_r(const time_t *timep,struct tm *tmp);
107
86
108
87
void pthread_exit (void * a ); /* was #define pthread_exit(A) ExitThread(A)*/
109
88
110
- #ifndef OS2
111
89
#define ETIMEDOUT 145 /* Win32 doesn't have this */
112
90
#define getpid () GetCurrentThreadId()
113
- #endif
114
91
#define pthread_self () win_pthread_self
115
92
#define HAVE_LOCALTIME_R 1
116
93
#define _REENTRANT 1
@@ -145,23 +122,13 @@ void pthread_exit(void *a); /* was #define pthread_exit(A) ExitThread(A)*/
145
122
#endif /* USE_TLS */
146
123
147
124
#define pthread_equal (A ,B ) ((A) == (B))
148
- #ifdef OS2
149
- extern int pthread_mutex_init (pthread_mutex_t * , const pthread_mutexattr_t * );
150
- extern int pthread_mutex_lock (pthread_mutex_t * );
151
- extern int pthread_mutex_unlock (pthread_mutex_t * );
152
- extern int pthread_mutex_destroy (pthread_mutex_t * );
153
- #define my_pthread_setprio (A ,B ) DosSetPriority(PRTYS_THREAD,PRTYC_NOCHANGE, B, A)
154
- #define pthread_kill (A ,B ) raise(B)
155
- #define pthread_exit (A ) pthread_dummy()
156
- #else
157
125
#define pthread_mutex_init (A ,B ) (InitializeCriticalSection(A),0)
158
126
#define pthread_mutex_lock (A ) (EnterCriticalSection(A),0)
159
127
#define pthread_mutex_trylock (A ) (WaitForSingleObject((A), 0) == WAIT_TIMEOUT)
160
128
#define pthread_mutex_unlock (A ) LeaveCriticalSection(A)
161
129
#define pthread_mutex_destroy (A ) DeleteCriticalSection(A)
162
130
#define my_pthread_setprio (A ,B ) SetThreadPriority(GetCurrentThread(), (B))
163
131
#define pthread_kill (A ,B ) pthread_dummy(0)
164
- #endif /* OS2 */
165
132
166
133
/* Dummy defines for easier code */
167
134
#define pthread_attr_setdetachstate (A ,B ) pthread_dummy(0)
@@ -257,9 +224,6 @@ extern int my_sigwait(const sigset_t *set,int *sig);
257
224
#ifdef HAVE_SYNCH_H
258
225
#include <synch.h>
259
226
#endif
260
- #if defined(__EMX__ ) && (!defined(EMX_PTHREAD_REV ) || (EMX_PTHREAD_REV < 2 ))
261
- #error Requires at least rev 2 of EMX pthreads library.
262
- #endif
263
227
264
228
#ifdef __NETWARE__
265
229
void my_pthread_exit (void * status );
@@ -382,15 +346,12 @@ extern int my_pthread_cond_timedwait(pthread_cond_t *cond,
382
346
#define pthread_cond_timedwait (A ,B ,C ) my_pthread_cond_timedwait((A),(B),(C))
383
347
#endif
384
348
385
- #if defined(OS2 )
386
- #define my_pthread_getspecific (T ,A ) ((T) &(A))
387
- #define pthread_setspecific (A ,B ) win_pthread_setspecific(&(A),(B),sizeof(A))
388
- #elif !defined( HAVE_NONPOSIX_PTHREAD_GETSPECIFIC )
349
+ #if !defined( HAVE_NONPOSIX_PTHREAD_GETSPECIFIC )
389
350
#define my_pthread_getspecific (A ,B ) ((A) pthread_getspecific(B))
390
351
#else
391
352
#define my_pthread_getspecific (A ,B ) ((A) my_pthread_getspecific_imp(B))
392
353
void * my_pthread_getspecific_imp (pthread_key_t key );
393
- #endif /* OS2 */
354
+ #endif
394
355
395
356
#ifndef HAVE_LOCALTIME_R
396
357
struct tm * localtime_r (const time_t * clock , struct tm * res );
0 commit comments