Commit 00912bda authored by sof's avatar sof
Browse files

[project @ 2004-03-13 00:56:45 by sof]

tidy up conditional forkProcess() support
parent 13c52eb2
/* --------------------------------------------------------------------------- /* ---------------------------------------------------------------------------
* $Id: Schedule.c,v 1.193 2004/03/01 14:18:35 simonmar Exp $ * $Id: Schedule.c,v 1.194 2004/03/13 00:56:45 sof Exp $
* *
* (c) The GHC Team, 1998-2003 * (c) The GHC Team, 1998-2003
* *
...@@ -1380,13 +1380,22 @@ isThreadBound(StgTSO* tso USED_IN_THREADED_RTS) ...@@ -1380,13 +1380,22 @@ isThreadBound(StgTSO* tso USED_IN_THREADED_RTS)
* Singleton fork(). Do not copy any running threads. * Singleton fork(). Do not copy any running threads.
* ------------------------------------------------------------------------- */ * ------------------------------------------------------------------------- */
#ifndef mingw32_TARGET_OS
#define FORKPROCESS_PRIMOP_SUPPORTED
#endif
#ifdef FORKPROCESS_PRIMOP_SUPPORTED
static void static void
deleteThreadImmediately(StgTSO *tso); deleteThreadImmediately(StgTSO *tso);
#endif
StgInt StgInt
forkProcess(HsStablePtr *entry) forkProcess(HsStablePtr *entry
#ifndef FORKPROCESS_PRIMOP_SUPPORTED
STG_UNUSED
#endif
)
{ {
#ifndef mingw32_TARGET_OS #ifdef FORKPROCESS_PRIMOP_SUPPORTED
pid_t pid; pid_t pid;
StgTSO* t,*next; StgTSO* t,*next;
StgMainThread *m; StgMainThread *m;
...@@ -1420,17 +1429,17 @@ forkProcess(HsStablePtr *entry) ...@@ -1420,17 +1429,17 @@ forkProcess(HsStablePtr *entry)
// wipe the main thread list // wipe the main thread list
while((m = main_threads) != NULL) { while((m = main_threads) != NULL) {
main_threads = m->link; main_threads = m->link;
#ifdef THREADED_RTS # ifdef THREADED_RTS
closeCondition(&m->bound_thread_cond); closeCondition(&m->bound_thread_cond);
#endif # endif
stgFree(m); stgFree(m);
} }
#ifdef RTS_SUPPORTS_THREADS # ifdef RTS_SUPPORTS_THREADS
resetTaskManagerAfterFork(); // tell startTask() and friends that resetTaskManagerAfterFork(); // tell startTask() and friends that
startingWorkerThread = rtsFalse; // we have no worker threads any more startingWorkerThread = rtsFalse; // we have no worker threads any more
resetWorkerWakeupPipeAfterFork(); resetWorkerWakeupPipeAfterFork();
#endif # endif
rc = rts_evalStableIO(entry, NULL); // run the action rc = rts_evalStableIO(entry, NULL); // run the action
rts_checkSchedStatus("forkProcess",rc); rts_checkSchedStatus("forkProcess",rc);
...@@ -1440,10 +1449,10 @@ forkProcess(HsStablePtr *entry) ...@@ -1440,10 +1449,10 @@ forkProcess(HsStablePtr *entry)
hs_exit(); // clean up and exit hs_exit(); // clean up and exit
stg_exit(0); stg_exit(0);
} }
#else /* mingw32 */ #else /* !FORKPROCESS_PRIMOP_SUPPORTED */
barf("forkProcess#: primop not implemented for mingw32, sorry!\n"); barf("forkProcess#: primop not supported, sorry!\n");
return -1; return -1;
#endif /* mingw32 */ #endif
} }
/* --------------------------------------------------------------------------- /* ---------------------------------------------------------------------------
...@@ -2931,6 +2940,7 @@ deleteThread(StgTSO *tso) ...@@ -2931,6 +2940,7 @@ deleteThread(StgTSO *tso)
raiseAsync(tso,NULL); raiseAsync(tso,NULL);
} }
#ifdef FORKPROCESS_PRIMOP_SUPPORTED
static void static void
deleteThreadImmediately(StgTSO *tso) deleteThreadImmediately(StgTSO *tso)
{ // for forkProcess only: { // for forkProcess only:
...@@ -2947,6 +2957,7 @@ deleteThreadImmediately(StgTSO *tso) ...@@ -2947,6 +2957,7 @@ deleteThreadImmediately(StgTSO *tso)
tso->what_next = ThreadKilled; tso->what_next = ThreadKilled;
} }
#endif
void void
raiseAsyncWithLock(StgTSO *tso, StgClosure *exception) raiseAsyncWithLock(StgTSO *tso, StgClosure *exception)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment