rts: Add api to pin a thread to a numa node but without fixing a capability
[ghc.git] / rts / HsFFI.c
1 /* -----------------------------------------------------------------------------
2 *
3 * (c) The GHC Team, 2005
4 *
5 * RTS entry points as mandated by the FFI section of the Haskell report
6 *
7 * ---------------------------------------------------------------------------*/
8
9 #include "PosixSource.h"
10 #include "HsFFI.h"
11 #include "Rts.h"
12
13 #include "Stable.h"
14 #include "Task.h"
15
16 // hs_init and hs_exit are defined in RtsStartup.c
17
18 void
19 hs_set_argv(int argc, char *argv[])
20 {
21 setProgArgv(argc,argv);
22 }
23
24 void
25 hs_perform_gc(void)
26 {
27 /* Hmmm, the FFI spec is a bit vague, but it seems to imply a major GC... */
28 performMajorGC();
29 }
30
31 void hs_lock_stable_tables (void)
32 {
33 stableLock();
34 }
35
36 void hs_unlock_stable_tables (void)
37 {
38 stableUnlock();
39 }
40
41 void
42 hs_free_stable_ptr(HsStablePtr sp)
43 {
44 /* The cast is for clarity only, both HsStablePtr and StgStablePtr are
45 typedefs for void*. */
46 freeStablePtr((StgStablePtr)sp);
47 }
48
49 void
50 hs_free_stable_ptr_unsafe(HsStablePtr sp)
51 {
52 /* The cast is for clarity only, both HsStablePtr and StgStablePtr are
53 typedefs for void*. */
54 freeStablePtrUnsafe((StgStablePtr)sp);
55 }
56
57 void
58 hs_free_fun_ptr(HsFunPtr fp)
59 {
60 /* I simply *love* all these similar names... */
61 freeHaskellFunctionPtr(fp);
62 }
63
64 void
65 hs_thread_done(void)
66 {
67 freeMyTask();
68 }