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 . --- implement.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'implement.h') 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