From 6cd9f4f23d033e61bc9c742a0598040b9caadf89 Mon Sep 17 00:00:00 2001 From: rpj Date: Fri, 8 Jan 1999 22:38:54 +0000 Subject: Sat Jan 9 14:32:08 1999 Ross Johnson * implement.h: Compile-time switch for CYGWIN derived environments to use CreateThread instead of _beginthreadex. Ditto for ExitThread. Patch provided by Anders Norlander . --- ChangeLog | 6 ++++++ README | 7 ++++--- implement.h | 31 +++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 007fe07..260398d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sat Jan 9 14:32:08 1999 Ross Johnson + + * implement.h: Compile-time switch for CYGWIN derived environments + to use CreateThread instead of _beginthreadex. Ditto for ExitThread. + Patch provided by Anders Norlander . + Tue Jan 5 16:33:04 1999 Ross Johnson * cleanup.c (_pthread_pop_cleanup): Add C++ version of __try/__except diff --git a/README b/README index 603ba90..71f33de 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ This directory contains an implementation of pthreads for Win32. Mailing list ------------ -Dec 10 1998 +Dec 10, 1998 There is a mailing list for discussing pthreads on Win32 which is managed by Majordomo. To subscribe, send mail to majordomo@air.net.au @@ -13,7 +13,7 @@ and place the fllowing text in the message body: Building the library with Cygwin32 or Mingw32 --------------------------------------------- -Dec 2 1998 +Jan 9, 1999 The package cannot yet be built using cygwin32 or mingw32 because the win32 compatibility stub libraries that come with those tools generate @@ -21,7 +21,8 @@ their stub library function calls from the Win95 dll set which don't include the _beginthreadx or _endthreadx functions used in this package. -A precompiled DLL and matching include file can be found at: +The complete zipped (should be pkunzip compatible) source code and +a precompiled DLL and matching pthread.h can be found at: ftp://sourceware.cygnus.com/pub/pthreads-win32 Home page: diff --git a/implement.h b/implement.h index 6bcedf6..79342e1 100644 --- a/implement.h +++ b/implement.h @@ -172,4 +172,35 @@ void _pthread_tkAssocDestroy (ThreadKeyAssoc * assoc); /* */ +/* + * Check for old and new versions of cygwin. See the FAQ file: + * + * Question 1 - How do I get pthreads-win32 to link under Cygwin32 or Mingw32? + * + * Patch by Anders Norlander + */ +#if defined(__CYGWIN32__) || defined(__CYGWIN__) + +/* Macro uses args so we can cast start_proc to LPTHREAD_START_ROUTINE + * in order to avoid warnings because of return type + */ + +#define _beginthreadex(security, \ + stack_size, \ + start_proc, \ + arg, \ + flags, \ + pid) \ + CreateThread(security, \ + stack_size, \ + (LPTHREAD_START_ROUTINE) start_proc, \ + arg, \ + flags, \ + pid) + +#define _endthreadex ExitThread + +#endif /* __CYGWIN32__ || __CYGWIN__ */ + + #endif /* _IMPLEMENT_H */ -- cgit v1.2.3