aboutsummaryrefslogtreecommitdiffstats
path: root/mps/code/th.h
diff options
context:
space:
mode:
Diffstat (limited to 'mps/code/th.h')
-rw-r--r--mps/code/th.h73
1 files changed, 73 insertions, 0 deletions
diff --git a/mps/code/th.h b/mps/code/th.h
new file mode 100644
index 00000000000..66ade83520d
--- /dev/null
+++ b/mps/code/th.h
@@ -0,0 +1,73 @@
1/* impl.h.th: THREAD MANAGER
2 *
3 * $HopeName$
4 * Copyright (C) 1995 Harlequin Limited. All rights reserved.
5 *
6 * .purpose: Provides thread suspension facilities to the shield.
7 * See design.mps.thread-manager. Each thread has to be
8 * individually registered and deregistered with an arena.
9 */
10
11#ifndef th_h
12#define th_h
13
14#include "mpmtypes.h"
15#include "ring.h"
16
17
18#define ThreadSig ((Sig)0x519286ED) /* SIGnature THREaD */
19
20extern Bool ThreadCheck(Thread thread);
21
22
23/* ThreadCheckSimple
24 *
25 * Simple thread-safe check of a thread object.
26 */
27
28extern Bool ThreadCheckSimple(Thread thread);
29
30
31extern Res ThreadDescribe(Thread thread, mps_lib_FILE *stream);
32
33
34/* Register/Deregister
35 *
36 * Explicitly register/deregister a thread on the arena threadRing.
37 * Register returns a "Thread" value which needs to be used
38 * for deregistration.
39 *
40 * Threads must not be multiply registered in the same arena.
41 */
42
43extern Res ThreadRegister(Thread *threadReturn, Arena arena);
44
45extern void ThreadDeregister(Thread thread, Arena arena);
46
47
48/* ThreadRingSuspend/Resume
49 *
50 * These functions suspend/resume the threads on the ring.
51 * If the current thread is among them, it is not suspended,
52 * nor is any attempt to resume it made.
53 */
54
55extern void ThreadRingSuspend(Ring threadRing);
56extern void ThreadRingResume(Ring threadRing);
57
58
59/* ThreadRingThread
60 *
61 * Return the thread from an element of the Arena's
62 * thread ring.
63 */
64
65extern Thread ThreadRingThread(Ring threadRing);
66
67
68extern Arena ThreadArena(Thread thread);
69
70extern Res ThreadScan(ScanState ss, Thread thread, void *stackBot);
71
72
73#endif /* th_h */