2 * (c) The GHC Team 2003
4 * $Id: forkOS.c,v 1.2 2003/09/23 16:18:03 sof Exp $
6 * Helper function for Control.Concurrent.forkOS
12 #if defined(HAVE_PTHREAD_H) && !defined(WANT_NATIVE_WIN32_THREADS)
16 forkOS_createThreadWrapper ( void * entry )
19 rts_evalStableIO((HsStablePtr) entry, NULL);
25 forkOS_createThread ( HsStablePtr entry )
28 int result = pthread_create(&tid, NULL,
29 forkOS_createThreadWrapper, (void*)entry);
35 #elif defined(HAVE_WINDOWS_H)
37 /* For reasons not yet clear, the entire contents of process.h is protected
38 * by __STRICT_ANSI__ not being defined.
40 #undef __STRICT_ANSI__
43 static unsigned __stdcall
44 forkOS_createThreadWrapper ( void * entry )
47 rts_evalStableIO((HsStablePtr) entry, NULL);
53 forkOS_createThread ( HsStablePtr entry )
56 return (_beginthreadex ( NULL, /* default security attributes */
58 forkOS_createThreadWrapper,
61 (unsigned*)&pId) == 0);