1 /* -----------------------------------------------------------------------------
2 * $Id: TSO.h,v 1.3 1999/01/13 17:25:55 simonm Exp $
4 * The definitions for Thread State Objects.
6 * ---------------------------------------------------------------------------*/
11 #if defined(PROFILING)
13 CostCentreStack *CCCS; /* thread's current CCS */
15 #else /* !PROFILING */
18 #endif /* PROFILING */
50 * We are completely paranoid and make thread IDs 64 bits to avoid
51 * having to worry about overflow. A little calculation shows that
52 * even doing 10^6 forks per second would take 35 million years to
53 * overflow a 64 bit thread ID :-)
55 typedef StgNat32 StgThreadID;
58 * This type is returned to the scheduler by a thread that has
59 * stopped for one reason or another.
63 HeapOverflow, /* might also be StackOverflow */
68 } StgThreadReturnCode;
71 * TSOs live on the heap, and therefore look just like heap objects.
72 * Large TSOs will live in their own "block group" allocated by the
73 * storage manager, and won't be copied during garbage collection.
76 typedef struct StgTSO_ {
79 StgMutClosure * mut_link; /* TSO's are mutable of course! */
80 StgTSOWhatNext whatNext;
81 StgTSOState state; /* necessary? */
83 /* Exception Handlers */
84 StgTSOTickyInfo ticky;
89 /* The thread stack... */
90 StgWord stack_size; /* stack size in *words* */
91 StgWord max_stack_size; /* maximum stack size in *words* */
99 extern StgTSO *CurrentTSO;
102 /* Workaround for a bug/quirk in gcc on certain architectures.
103 * symptom is that (&tso->stack - &tso->header) /= sizeof(StgTSO)
104 * in other words, gcc pads the structure at the end.
107 extern StgTSO dummy_tso;
109 #define TSO_STRUCT_SIZE \
110 ((int)&(dummy_tso).stack - (int)&(dummy_tso).header)
112 #define TSO_STRUCT_SIZEW (TSO_STRUCT_SIZE / sizeof(W_))