[project @ 2003-09-24 11:06:54 by simonmar]
authorsimonmar <unknown>
Wed, 24 Sep 2003 11:06:54 +0000 (11:06 +0000)
committersimonmar <unknown>
Wed, 24 Sep 2003 11:06:54 +0000 (11:06 +0000)
Move forkOS_createThread into the RTS so its implementation can be
dependent on RTS_SUPPORTS_THREADS, which means we can provide a stub
implementation in the !RTS_SUPPORTS_THREADS case, and hence not depend
on pthread_create, which requires -lpthread.  The upshot is that GHCi
now works again when !RTS_SUPPORTS_THREADS.

cbits/forkOS.c [deleted file]
include/HsBase.h

diff --git a/cbits/forkOS.c b/cbits/forkOS.c
deleted file mode 100644 (file)
index 4e35738..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/* 
- * (c) The GHC Team 2003
- *
- * $Id: forkOS.c,v 1.2 2003/09/23 16:18:03 sof Exp $
- *
- * Helper function for Control.Concurrent.forkOS
- */
-
-#include "HsBase.h"
-#include "RtsAPI.h"
-
-#if defined(HAVE_PTHREAD_H) && !defined(WANT_NATIVE_WIN32_THREADS)
-#include <pthread.h>
-
-static void *
-forkOS_createThreadWrapper ( void * entry )
-{
-    rts_lock();
-    rts_evalStableIO((HsStablePtr) entry, NULL);
-    rts_unlock();
-    return NULL;
-}
-
-int
-forkOS_createThread ( HsStablePtr entry )
-{
-    pthread_t tid;
-    int result = pthread_create(&tid, NULL,
-                               forkOS_createThreadWrapper, (void*)entry);
-    if(!result)
-        pthread_detach(tid);
-    return result;
-}
-
-#elif defined(HAVE_WINDOWS_H)
-#include <windows.h>
-/* For reasons not yet clear, the entire contents of process.h is protected 
- * by __STRICT_ANSI__ not being defined.
- */
-#undef __STRICT_ANSI__
-#include <process.h>
-
-static unsigned __stdcall
-forkOS_createThreadWrapper ( void * entry )
-{
-    rts_lock();
-    rts_evalStableIO((HsStablePtr) entry, NULL);
-    rts_unlock();
-    return 0;
-}
-
-int
-forkOS_createThread ( HsStablePtr entry )
-{
-    unsigned long pId;
-    return (_beginthreadex ( NULL,  /* default security attributes */
-                          0,
-                          forkOS_createThreadWrapper,
-                          (void*)entry,
-                          0,
-                          (unsigned*)&pId) == 0);
-}
-
-#else
-#endif
index 47d028d..d9ef002 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: HsBase.h,v 1.28 2003/09/24 10:32:12 simonmar Exp $
+ * $Id: HsBase.h,v 1.29 2003/09/24 11:06:54 simonmar Exp $
  *
  * (c) The University of Glasgow 2001-2002
  *
@@ -129,9 +129,6 @@ int inputReady(int fd, int msecs, int isSock);
 /* in writeError.c */
 void writeErrString__(HsAddr msg_hdr, HsAddr msg, HsInt len);
 
-/* in forkOS.c */
-int forkOS_createThread ( HsStablePtr entry );
-
 /* in Signals.c */
 extern HsInt nocldstop;