[project @ 1999-09-10 11:11:51 by simonmar]
[ghc-hetmet.git] / ghc / rts / Schedule.h
index adaf078..3bc46d5 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Schedule.h,v 1.4 1999/03/02 20:04:04 sof Exp $
+ * $Id: Schedule.h,v 1.7 1999/09/10 11:11:52 simonmar Exp $
  *
  * (c) The GHC Team 1998-1999
  *
@@ -18,17 +18,24 @@ void    initScheduler(void);
  * Miscellany
  */
 
-void    awaken_blocked_queue(StgTSO *tso);
-
+void    awakenBlockedQueue(StgTSO *tso);
+StgTSO *unblockOne(StgTSO *tso);
 void    initThread(StgTSO *tso, nat stack_size);
-
 void    interruptStgRts(void);
+void    raiseAsync(StgTSO *tso, StgClosure *exception);
 
 extern  nat context_switch;
 
+void    awaitEvent(rtsBool wait);  /* In Select.c */
+extern  nat ticks_since_select;           /* ditto */
+
 extern  StgTSO *run_queue_hd, *run_queue_tl;
 extern  StgTSO *blocked_queue_hd, *blocked_queue_tl;
 
+#ifdef DEBUG
+extern void printThreadBlockage(StgTSO *tso);
+#endif
+
 #ifdef COMPILING_RTS_MAIN
 extern DLLIMPORT StgTSO *MainTSO; /* temporary hack */
 #else
@@ -36,6 +43,9 @@ extern StgTSO *MainTSO; /* temporary hack */
 #endif
 #define END_TSO_QUEUE  ((StgTSO *)(void*)&END_TSO_QUEUE_closure)
 
+/* Add a thread to the end of the run queue.
+ * NOTE: tso->link should be END_TSO_QUEUE before calling this macro.
+ */
 #define PUSH_ON_RUN_QUEUE(tso)                 \
     if (run_queue_hd == END_TSO_QUEUE) {        \
       run_queue_hd = tso;                      \
@@ -44,4 +54,12 @@ extern StgTSO *MainTSO; /* temporary hack */
     }                                          \
     run_queue_tl = tso;
 
+#define PUSH_ON_BLOCKED_QUEUE(tso)             \
+    if (blocked_queue_hd == END_TSO_QUEUE) {    \
+      blocked_queue_hd = tso;                  \
+    } else {                                   \
+      blocked_queue_tl->link = tso;            \
+    }                                          \
+    blocked_queue_tl = tso;
+
 #define END_CAF_LIST  stgCast(StgCAF*,(void*)&END_TSO_QUEUE_closure)