+ * We distinguish between the various classes of threads in the system.
+ */
+
+typedef enum {
+ AdvisoryPriority,
+ MandatoryPriority,
+ RevalPriority
+} StgThreadPriority;
+
+/*
+ * Threads may be blocked for several reasons. A blocked thread will
+ * have the reason in the why_blocked field of the TSO, and some
+ * further info (such as the closure the thread is blocked on, or the
+ * file descriptor if the thread is waiting on I/O) in the block_info
+ * field.
+ */
+
+typedef enum {
+ NotBlocked,
+ BlockedOnMVar,
+ BlockedOnBlackHole,
+ BlockedOnException,
+ BlockedOnRead,
+ BlockedOnWrite,
+ BlockedOnDelay
+#if defined(mingw32_TARGET_OS)
+ , BlockedOnDoProc
+#endif
+#if defined(PAR)
+ , BlockedOnGA // blocked on a remote closure represented by a Global Address
+ , BlockedOnGA_NoSend // same as above but without sending a Fetch message
+#endif
+#if defined(RTS_SUPPORTS_THREADS)
+ , BlockedOnCCall
+ , BlockedOnCCall_NoUnblockExc // same as above but don't unblock async exceptions
+ // in resumeThread()
+#endif
+} StgTSOBlockReason;
+
+#if defined(mingw32_TARGET_OS)
+/* results from an async I/O request + it's ID. */
+typedef struct {
+ unsigned int reqID;
+ int len;
+ int errCode;
+} StgAsyncIOResult;
+#endif
+
+typedef union {
+ StgClosure *closure;
+ struct StgTSO_ *tso;
+ int fd;
+#if defined(mingw32_TARGET_OS)
+ StgAsyncIOResult* async_result;
+#endif
+ unsigned int target;
+} StgTSOBlockInfo;
+
+/*