summaryrefslogtreecommitdiff
path: root/ghc/includes/SchedAPI.h
diff options
context:
space:
mode:
authorwolfgang <unknown>2003-09-21 22:20:57 +0000
committerwolfgang <unknown>2003-09-21 22:20:57 +0000
commit85aa72b9dc6803685595936c61f3cab6faab815a (patch)
tree7606cd38aade5427ed3c1a936739164dcb7bbfa3 /ghc/includes/SchedAPI.h
parent6f0dcafbc883c851aaf6d5a7c446ddaaebe23361 (diff)
downloadhaskell-85aa72b9dc6803685595936c61f3cab6faab815a.tar.gz
[project @ 2003-09-21 22:20:51 by wolfgang]
Bound Threads ============= Introduce a way to use foreign libraries that rely on thread local state from multiple threads (mainly affects the threaded RTS). See the file threads.tex in CVS at haskell-report/ffi/threads.tex (not entirely finished yet) for a definition of this extension. A less formal description is also found in the documentation of Control.Concurrent. The changes mostly affect the THREADED_RTS (./configure --enable-threaded-rts), except for saving & restoring errno on a per-TSO basis, which is also necessary for the non-threaded RTS (a bugfix). Detailed list of changes ------------------------ - errno is saved in the TSO object and restored when necessary: ghc/includes/TSO.h, ghc/rts/Interpreter.c, ghc/rts/Schedule.c - rts_mainLazyIO is no longer needed, main is no special case anymore ghc/includes/RtsAPI.h, ghc/rts/RtsAPI.c, ghc/rts/Main.c, ghc/rts/Weak.c - passCapability: a new function that releases the capability and "passes" it to a specific OS thread: ghc/rts/Capability.h ghc/rts/Capability.c - waitThread(), scheduleWaitThread() and schedule() get an optional Capability *initialCapability passed as an argument: ghc/includes/SchedAPI.h, ghc/rts/Schedule.c, ghc/rts/RtsAPI.c - Bound Thread scheduling (that's what this is all about): ghc/rts/Schedule.h, ghc/rts/Schedule.c - new Primop isCurrentThreadBound#: ghc/compiler/prelude/primops.txt.pp, ghc/includes/PrimOps.h, ghc/rts/PrimOps.hc, ghc/rts/Schedule.h, ghc/rts/Schedule.c - a simple function, rtsSupportsBoundThreads, that returns true if THREADED_RTS is defined: ghc/rts/Schedule.h, ghc/rts/Schedule.c - a new implementation of forkProcess (the old implementation stays in place for the non-threaded case). Partially broken; works for the standard fork-and-exec case, but not for much else. A proper forkProcess is really next to impossible to implement: ghc/rts/Schedule.c - Library support for bound threads: Control.Concurrent. rtsSupportsBoundThreads, isCurrentThreadBound, forkOS, runInBoundThread, runInUnboundThread libraries/base/Control/Concurrent.hs, libraries/base/Makefile, libraries/base/include/HsBase.h, libraries/base/cbits/forkOS.c (new file)
Diffstat (limited to 'ghc/includes/SchedAPI.h')
-rw-r--r--ghc/includes/SchedAPI.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/ghc/includes/SchedAPI.h b/ghc/includes/SchedAPI.h
index 524b1da9f5..b0cee60f04 100644
--- a/ghc/includes/SchedAPI.h
+++ b/ghc/includes/SchedAPI.h
@@ -1,5 +1,5 @@
/* -----------------------------------------------------------------------------
- * $Id: SchedAPI.h,v 1.17 2002/12/27 12:33:21 panne Exp $
+ * $Id: SchedAPI.h,v 1.18 2003/09/21 22:20:53 wolfgang Exp $
*
* (c) The GHC Team 1998-2002
*
@@ -16,7 +16,8 @@
#define NO_PRI 0
#endif
-extern SchedulerStatus waitThread(StgTSO *main_thread, /*out*/StgClosure **ret);
+extern SchedulerStatus waitThread(StgTSO *main_thread, /*out*/StgClosure **ret,
+ Capability *initialCapability);
/*
* Creating threads
@@ -30,7 +31,8 @@ extern StgTSO *createThread(nat stack_size);
extern void taskStart(void);
#endif
extern void scheduleThread(StgTSO *tso);
-extern SchedulerStatus scheduleWaitThread(StgTSO *tso, /*out*/HaskellObj* ret);
+extern SchedulerStatus scheduleWaitThread(StgTSO *tso, /*out*/HaskellObj* ret,
+ Capability *initialCapability);
static inline void pushClosure (StgTSO *tso, StgWord c) {
tso->sp--;