1 /* -----------------------------------------------------------------------------
2 * $Id: TSO.h,v 1.2 1998/12/02 13:21:43 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 StgNat64 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 StgTSOWhatNext whatNext;
80 StgTSOState state; /* necessary? */
82 /* Exception Handlers */
83 StgTSOTickyInfo ticky;
88 /* The thread stack... */
89 StgWord stack_size; /* stack size in *words* */
90 StgWord max_stack_size; /* maximum stack size in *words* */
98 extern StgTSO *CurrentTSO;
101 /* Workaround for a bug/quirk in gcc on certain architectures.
102 * symptom is that (&tso->stack - &tso->header) /= sizeof(StgTSO)
103 * in other words, gcc pads the structure at the end.
106 extern StgTSO dummy_tso;
108 #define TSO_STRUCT_SIZE \
109 ((int)&(dummy_tso).stack - (int)&(dummy_tso).header)
111 #define TSO_STRUCT_SIZEW (TSO_STRUCT_SIZE / sizeof(W_))