Remove ghc-pkg's dependency on haskell98
[ghc-hetmet.git] / includes / rts / Threads.h
1 /* -----------------------------------------------------------------------------
2  *
3  * (c) The GHC Team 1998-2009
4  *
5  * External API for the scheduler.  For most uses, the functions in
6  * RtsAPI.h should be enough.
7  *
8  * Do not #include this file directly: #include "Rts.h" instead.
9  *
10  * To understand the structure of the RTS headers, see the wiki:
11  *   http://hackage.haskell.org/trac/ghc/wiki/Commentary/SourceTree/Includes
12  *
13  * ---------------------------------------------------------------------------*/
14
15 #ifndef RTS_THREADS_H
16 #define RTS_THREADS_H
17
18 // 
19 // Creating threads
20 //
21 StgTSO *createThread (Capability *cap, nat stack_size);
22
23 Capability *scheduleWaitThread (StgTSO *tso, /*out*/HaskellObj* ret,
24                                 Capability *cap);
25
26 StgTSO *createGenThread       (Capability *cap, nat stack_size,  
27                                StgClosure *closure);
28 StgTSO *createIOThread        (Capability *cap, nat stack_size,  
29                                StgClosure *closure);
30 StgTSO *createStrictIOThread  (Capability *cap, nat stack_size,  
31                                StgClosure *closure);
32
33 // Suspending/resuming threads around foreign calls
34 void *        suspendThread (StgRegTable *);
35 StgRegTable * resumeThread  (void *);
36
37 //
38 // Thread operations from Threads.c
39 //
40 int    cmp_thread      (StgPtr tso1, StgPtr tso2);
41 int    rts_getThreadId (StgPtr tso);
42
43 #if !defined(mingw32_HOST_OS)
44 pid_t  forkProcess     (HsStablePtr *entry);
45 #else
46 pid_t  forkProcess     (HsStablePtr *entry)
47     GNU_ATTRIBUTE(__noreturn__);
48 #endif
49
50 HsBool rtsSupportsBoundThreads (void);
51
52 // The number of Capabilities
53 extern unsigned int n_capabilities;
54
55 #if !IN_STG_CODE
56 extern Capability MainCapability;
57 #endif
58
59 #endif /* RTS_THREADS_H */