typedef struct StgTSO_ {
StgHeader header;
- struct StgTSO_* link; /* Links threads onto blocking queues */
+ /* The link field, for linking threads together in lists (e.g. the
+ run queue on a Capability.
+ */
+ struct StgTSO_* _link;
+ /*
+ NOTE!!! do not modify _link directly, it is subject to
+ a write barrier for generational GC. Instead use the
+ setTSOLink() function. Exceptions to this rule are:
+
+ * setting the link field to END_TSO_QUEUE
+ * putting a TSO on the blackhole_queue
+ * setting the link field of the currently running TSO, as it
+ will already be dirty.
+ */
+
struct StgTSO_* global_link; /* Links all threads together */
StgWord16 what_next; /* Values defined in Constants.h */
#ifdef DIST
StgTSODistInfo dist;
#endif
+#ifdef mingw32_HOST_OS
+ StgWord32 saved_winerror;
+#endif
/* The thread stack... */
StgWord32 stack_size; /* stack size in *words* */
} StgTSO;
/* -----------------------------------------------------------------------------
+ functions
+ -------------------------------------------------------------------------- */
+
+extern void dirty_TSO (Capability *cap, StgTSO *tso);
+extern void setTSOLink (Capability *cap, StgTSO *tso, StgTSO *target);
+
+/* -----------------------------------------------------------------------------
Invariants:
An active thread has the following properties: