X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FSchedule.h;h=00b4de17977f02ca76ad7617192e00d74e63493f;hb=6ea86573500e4a576d22feec71e36cf27c94aaa9;hp=5c90636c02bb9880061dadff1834404b1d62c0ae;hpb=4a939ead4265ab68ac24e63c50260afc3731dea2;p=ghc-hetmet.git diff --git a/ghc/rts/Schedule.h b/ghc/rts/Schedule.h index 5c90636..00b4de1 100644 --- a/ghc/rts/Schedule.h +++ b/ghc/rts/Schedule.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Schedule.h,v 1.14 2000/01/14 11:45:21 hwloidl Exp $ + * $Id: Schedule.h,v 1.22 2001/03/22 03:51:10 hwloidl Exp $ * * (c) The GHC Team 1998-1999 * @@ -58,10 +58,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 @@ -86,6 +84,15 @@ void raiseAsync(StgTSO *tso, StgClosure *exception); */ void awaitEvent(rtsBool wait); /* In Select.c */ +/* wakeUpSleepingThreads(nat ticks) + * + * Wakes up any sleeping threads whose timers have expired. + * + * Called from STG : NO + * Locks assumed : sched_mutex + */ +rtsBool wakeUpSleepingThreads(nat); /* In Select.c */ + // ToDo: check whether all fcts below are used in the SMP version, too //@cindex awaken_blocked_queue #if defined(GRAN) @@ -103,12 +110,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 @@ -119,7 +120,9 @@ void print_bq (StgClosure *node); extern nat context_switch; extern rtsBool interrupted; -extern nat ticks_since_select; +/* In Select.c */ +extern nat timestamp; +extern nat ticks_since_timestamp; //@cindex Capability /* Capability type @@ -138,9 +141,18 @@ 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; +extern StgTSO *sleeping_queue; +#endif +/* Linked list of all threads. */ +extern StgTSO *all_threads; #ifdef SMP //@cindex sched_mutex @@ -165,26 +177,35 @@ 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); +#if defined(PAR) +void print_bqe (StgBlockingQueueElement *bqe); +#endif + /* ----------------------------------------------------------------------------- * Some convenient macros... */ -#define END_TSO_QUEUE ((StgTSO *)(void*)&END_TSO_QUEUE_closure) -#define END_CAF_LIST ((StgCAF *)(void*)&END_TSO_QUEUE_closure) +/* END_TSO_QUEUE and friends now defined in includes/StgMiscClosures.h */ //@cindex APPEND_TO_RUN_QUEUE /* Add a thread to the end of the run queue. @@ -210,7 +231,7 @@ void raiseAsync(StgTSO *tso, StgClosure *exception); run_queue_tl = tso; \ } -//@cindex POP_RUN_QUEUE +//@cindex POP_RUN_QUEUE /* Pop the first thread off the runnable queue. */ #define POP_RUN_QUEUE() \ @@ -251,6 +272,11 @@ void raiseAsync(StgTSO *tso, StgClosure *exception); #define THREAD_RUNNABLE() /* nothing */ #endif +//@cindex EMPTY_RUN_QUEUE +/* Check whether the run queue is empty i.e. the PE is idle + */ +#define EMPTY_RUN_QUEUE() (run_queue_hd == END_TSO_QUEUE) + //@node Index, , Some convenient macros //@subsection Index