Windows build fixes
[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  * ---------------------------------------------------------------------------*/
9
10 #ifndef RTS_THREADS_H
11 #define RTS_THREADS_H
12
13 // 
14 // Creating threads
15 //
16 StgTSO *createThread (Capability *cap, nat stack_size);
17
18 Capability *scheduleWaitThread (StgTSO *tso, /*out*/HaskellObj* ret,
19                                 Capability *cap);
20
21 StgTSO *createGenThread       (Capability *cap, nat stack_size,  
22                                StgClosure *closure);
23 StgTSO *createIOThread        (Capability *cap, nat stack_size,  
24                                StgClosure *closure);
25 StgTSO *createStrictIOThread  (Capability *cap, nat stack_size,  
26                                StgClosure *closure);
27
28 // Suspending/resuming threads around foreign calls
29 void *        suspendThread (StgRegTable *);
30 StgRegTable * resumeThread  (void *);
31
32 //
33 // Thread operations from Threads.c
34 //
35 int    cmp_thread      (StgPtr tso1, StgPtr tso2);
36 int    rts_getThreadId (StgPtr tso);
37
38 #if !defined(mingw32_HOST_OS)
39 pid_t  forkProcess     (HsStablePtr *entry);
40 #else
41 pid_t  forkProcess     (HsStablePtr *entry)
42     GNU_ATTRIBUTE(__noreturn__);
43 #endif
44
45 HsBool rtsSupportsBoundThreads (void);
46
47 // The number of Capabilities
48 extern unsigned int n_capabilities;
49
50 #if !IN_STG_CODE
51 extern Capability MainCapability;
52 #endif
53
54 #endif /* RTS_THREADS_H */