@@ -31,19 +31,9 @@ extern "C" {
3131#define EXTERNC
3232#endif /* __cplusplus */
3333
34- #if defined(__WIN__) || defined(OS2)
34+ #if defined(__WIN__)
3535
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
4536typedef CRITICAL_SECTION pthread_mutex_t ;
46- #endif
4737typedef HANDLE pthread_t ;
4838typedef struct thread_attr {
4939 DWORD dwStackSize ;
@@ -62,30 +52,19 @@ typedef struct st_pthread_link {
6252
6353typedef struct {
6454 uint32 waiting ;
65- #ifdef OS2
66- HEV semaphore ;
67- #else
6855 HANDLE semaphore ;
69- #endif
7056} pthread_cond_t ;
7157
7258
73- #ifndef OS2
7459struct timespec { /* For pthread_cond_timedwait() */
7560 time_t tv_sec ;
7661 long tv_nsec ;
7762};
78- #endif
7963
8064typedef int pthread_mutexattr_t ;
8165#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
8666#define pthread_handler_t EXTERNC void * __cdecl
8767typedef void * (__cdecl * pthread_handler )(void * );
88- #endif
8968
9069void win_pthread_init (void );
9170int win_pthread_setspecific (void * A ,void * B ,uint length );
@@ -107,10 +86,8 @@ struct tm *gmtime_r(const time_t *timep,struct tm *tmp);
10786
10887void pthread_exit (void * a ); /* was #define pthread_exit(A) ExitThread(A)*/
10988
110- #ifndef OS2
11189#define ETIMEDOUT 145 /* Win32 doesn't have this */
11290#define getpid () GetCurrentThreadId()
113- #endif
11491#define pthread_self () win_pthread_self
11592#define HAVE_LOCALTIME_R 1
11693#define _REENTRANT 1
@@ -145,23 +122,13 @@ void pthread_exit(void *a); /* was #define pthread_exit(A) ExitThread(A)*/
145122#endif /* USE_TLS */
146123
147124#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
157125#define pthread_mutex_init (A ,B ) (InitializeCriticalSection(A),0)
158126#define pthread_mutex_lock (A ) (EnterCriticalSection(A),0)
159127#define pthread_mutex_trylock (A ) (WaitForSingleObject((A), 0) == WAIT_TIMEOUT)
160128#define pthread_mutex_unlock (A ) LeaveCriticalSection(A)
161129#define pthread_mutex_destroy (A ) DeleteCriticalSection(A)
162130#define my_pthread_setprio (A ,B ) SetThreadPriority(GetCurrentThread(), (B))
163131#define pthread_kill (A ,B ) pthread_dummy(0)
164- #endif /* OS2 */
165132
166133/* Dummy defines for easier code */
167134#define pthread_attr_setdetachstate (A ,B ) pthread_dummy(0)
@@ -257,9 +224,6 @@ extern int my_sigwait(const sigset_t *set,int *sig);
257224#ifdef HAVE_SYNCH_H
258225#include <synch.h>
259226#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
263227
264228#ifdef __NETWARE__
265229void my_pthread_exit (void * status );
@@ -382,15 +346,12 @@ extern int my_pthread_cond_timedwait(pthread_cond_t *cond,
382346#define pthread_cond_timedwait (A ,B ,C ) my_pthread_cond_timedwait((A),(B),(C))
383347#endif
384348
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 )
389350#define my_pthread_getspecific (A ,B ) ((A) pthread_getspecific(B))
390351#else
391352#define my_pthread_getspecific (A ,B ) ((A) my_pthread_getspecific_imp(B))
392353void * my_pthread_getspecific_imp (pthread_key_t key );
393- #endif /* OS2 */
354+ #endif
394355
395356#ifndef HAVE_LOCALTIME_R
396357struct tm * localtime_r (const time_t * clock , struct tm * res );
0 commit comments