X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FSchedule.h;h=d0c3f9923dc5d9f4e2db873205a674eda5a6cac4;hb=798374a5fa613d622b70cd4c37bb97f203abb6ba;hp=a8a3b01cd39cd6703db12917c89d9fde5798bad1;hpb=837abbff4b92909533932fa16cdd31fc8ab10b12;p=ghc-hetmet.git diff --git a/ghc/rts/Schedule.h b/ghc/rts/Schedule.h index a8a3b01..d0c3f99 100644 --- a/ghc/rts/Schedule.h +++ b/ghc/rts/Schedule.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Schedule.h,v 1.15 2000/01/14 14:06:48 hwloidl Exp $ + * $Id: Schedule.h,v 1.18 2000/04/14 15:18:07 sewardj Exp $ * * (c) The GHC Team 1998-1999 * @@ -32,6 +32,7 @@ void exitScheduler( void ); void startTasks( void ); #endif + //@cindex awakenBlockedQueue /* awakenBlockedQueue() * @@ -58,10 +59,8 @@ void awakenBlockedQueue(StgTSO *tso); * Called from STG : yes * Locks assumed : none */ -#if defined(GRAN) -StgTSO *unblockOne(StgTSO *tso, StgClosure *node); -#elif defined(PAR) -StgTSO *unblockOne(StgTSO *tso, StgClosure *node); +#if defined(GRAN) || defined(PAR) +StgBlockingQueueElement *unblockOne(StgBlockingQueueElement *bqe, StgClosure *node); #else StgTSO *unblockOne(StgTSO *tso); #endif @@ -103,12 +102,6 @@ void awaken_blocked_queue(StgTSO *q); void initThread(StgTSO *tso, nat stack_size); #endif -// debugging only -#ifdef DEBUG -extern void printThreadBlockage(StgTSO *tso); -#endif -void print_bq (StgClosure *node); - //@node Scheduler Vars and Data Types, Some convenient macros, Scheduler Functions //@subsection Scheduler Vars and Data Types @@ -138,9 +131,17 @@ extern Capability MainRegTable; /* Thread queues. * Locks required : sched_mutex + * + * In GranSim we have one run/blocked_queue per PE. */ +#if defined(GRAN) +// run_queue_hds defined in GranSim.h +#else extern StgTSO *run_queue_hd, *run_queue_tl; extern StgTSO *blocked_queue_hd, *blocked_queue_tl; +#endif +/* Linked list of all threads. */ +extern StgTSO *all_threads; #ifdef SMP //@cindex sched_mutex @@ -165,28 +166,41 @@ typedef struct { extern task_info *task_ids; #endif -#if !defined(GRAN) -extern StgTSO *run_queue_hd, *run_queue_tl; -extern StgTSO *blocked_queue_hd, *blocked_queue_tl; -#endif - /* Needed by Hugs. */ void interruptStgRts ( void ); -// ?? needed -- HWL void raiseAsync(StgTSO *tso, StgClosure *exception); nat run_queue_len(void); +void resurrectThreads( StgTSO * ); + //@node Some convenient macros, Index, Scheduler Vars and Data Types //@subsection Some convenient macros +/* debugging only + */ +#ifdef DEBUG +void printThreadBlockage(StgTSO *tso); +void printThreadStatus(StgTSO *tso); +void printAllThreads(void); +#endif +void print_bq (StgClosure *node); + /* ----------------------------------------------------------------------------- * Some convenient macros... */ +/* this is the NIL ptr for a TSO queue (e.g. runnable queue) */ #define END_TSO_QUEUE ((StgTSO *)(void*)&END_TSO_QUEUE_closure) -#define END_CAF_LIST ((StgCAF *)(void*)&END_TSO_QUEUE_closure) +/* this is the NIL ptr for a list CAFs */ +#define END_ECAF_LIST ((StgCAF *)(void*)&END_TSO_QUEUE_closure) +#if defined(PAR) || defined(GRAN) +/* this is the NIL ptr for a blocking queue */ +# define END_BQ_QUEUE ((StgBlockingQueueElement *)(void*)&END_TSO_QUEUE_closure) +/* this is the NIL ptr for a blocked fetch queue (as in PendingFetches in GUM) */ +# define END_BF_QUEUE ((StgBlockedFetch *)(void*)&END_TSO_QUEUE_closure) +#endif //@cindex APPEND_TO_RUN_QUEUE /* Add a thread to the end of the run queue. @@ -212,7 +226,7 @@ nat run_queue_len(void); run_queue_tl = tso; \ } -//@cindex POP_RUN_QUEUE +//@cindex POP_RUN_QUEUE /* Pop the first thread off the runnable queue. */ #define POP_RUN_QUEUE() \