hadrian: eliminate most of the remaining big rule enumerations
[ghc.git] / rts / StablePtr.h
1 /* -----------------------------------------------------------------------------
2 *
3 * (c) The GHC Team, 1998-2004
4 *
5 * Stable Pointers: A stable pointer is represented as an index into
6 * the stable pointer table.
7 *
8 * StgStablePtr used to be a synonym for StgWord, but stable pointers
9 * are guaranteed to be void* on the C-side, so we have to do some
10 * occasional casting. Size is not a matter, because StgWord is always
11 * the same size as a void*.
12 *
13 * ---------------------------------------------------------------------------*/
14
15 #pragma once
16
17 #include "sm/GC.h" // for evac_fn below
18
19 #include "BeginPrivate.h"
20
21 void freeStablePtr ( StgStablePtr sp );
22
23 /* Use the "Unsafe" one after only when manually locking and
24 unlocking with stablePtrLock/stablePtrUnlock */
25 void freeStablePtrUnsafe ( StgStablePtr sp );
26
27 void initStablePtrTable ( void );
28 void exitStablePtrTable ( void );
29
30 /* Call given function on every stable ptr. markStablePtrTable depends
31 * on the function updating its pointers in case the object is
32 * moved.
33 */
34 void markStablePtrTable ( evac_fn evac, void *user );
35
36 void threadStablePtrTable ( evac_fn evac, void *user );
37
38 void stablePtrLock ( void );
39 void stablePtrUnlock ( void );
40
41 #if defined(THREADED_RTS)
42 // needed by Schedule.c:forkProcess()
43 extern Mutex stable_ptr_mutex;
44 #endif
45
46 #include "EndPrivate.h"