X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FSchedule.h;h=b2a07e46214d90f3bea65e39833dcbe278a8ec8b;hb=538cf5105b079fa779b612c6154db2bb4febb586;hp=7722802cbddcd302699d9777751f727576db3632;hpb=d9d8ab1594dd83d25708dc0d20dfd8e068f1c2e3;p=ghc-hetmet.git diff --git a/ghc/rts/Schedule.h b/ghc/rts/Schedule.h index 7722802..b2a07e4 100644 --- a/ghc/rts/Schedule.h +++ b/ghc/rts/Schedule.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Schedule.h,v 1.35 2002/07/25 18:37:00 sof Exp $ + * $Id: Schedule.h,v 1.38 2003/03/17 14:47:48 simonmar Exp $ * * (c) The GHC Team 1998-1999 * @@ -34,6 +34,9 @@ void awakenBlockedQueue(StgBlockingQueueElement *q, StgClosure *node); void awakenBlockedQueue(StgBlockingQueueElement *q, StgClosure *node); #else void awakenBlockedQueue(StgTSO *tso); +#if defined(RTS_SUPPORTS_THREADS) +void awakenBlockedQueueNoLock(StgTSO *tso); +#endif #endif /* unblockOne() @@ -60,9 +63,9 @@ StgTSO *unblockOne(StgTSO *tso); void raiseAsync(StgTSO *tso, StgClosure *exception); void raiseAsyncWithLock(StgTSO *tso, StgClosure *exception); -/* awaitEvent() +/* awaitEvent(rtsBool wait) * - * Raises an exception asynchronously in the specified thread. + * Checks for blocked threads that need to be woken. * * Called from STG : NO * Locks assumed : sched_mutex @@ -78,6 +81,16 @@ void awaitEvent(rtsBool wait); /* In Select.c */ */ rtsBool wakeUpSleepingThreads(nat); /* In Select.c */ +/* wakeBlockedWorkerThread() + * + * If a worker thread is currently blocked in awaitEvent(), interrupt it. + * + * Called from STG : NO + * Locks assumed : sched_mutex + */ +void wakeBlockedWorkerThread(void); /* In Select.c */ + + /* GetRoots(evac_fn f) * * Call f() for each root known to the scheduler. @@ -138,7 +151,7 @@ extern nat rts_n_waiting_tasks; StgInt forkProcess(StgTSO *tso); -extern SchedulerStatus rts_mainEvalIO(HaskellObj p, /*out*/HaskellObj *ret); +extern SchedulerStatus rts_mainLazyIO(HaskellObj p, /*out*/HaskellObj *ret); /* Called by shutdown_handler(). */ @@ -174,6 +187,10 @@ typedef struct StgMainThread_ { StgClosure ** ret; #if defined(RTS_SUPPORTS_THREADS) Condition wakeup; +#if defined(THREADED_RTS) + rtsBool thread_bound; + Condition bound_thread_cond; +#endif #endif struct StgMainThread_ *link; } StgMainThread; @@ -197,6 +214,8 @@ void print_bq (StgClosure *node); void print_bqe (StgBlockingQueueElement *bqe); #endif +void labelThread(StgPtr tso, char *label); + /* ----------------------------------------------------------------------------- * Some convenient macros... */ @@ -255,9 +274,7 @@ void print_bqe (StgBlockingQueueElement *bqe); */ #if defined(RTS_SUPPORTS_THREADS) #define THREAD_RUNNABLE() \ - if ( !noCapabilities() ) { \ - signalCondition(&thread_ready_cond); \ - } \ + wakeBlockedWorkerThread(); \ context_switch = 1; #else #define THREAD_RUNNABLE() /* nothing */ @@ -275,4 +292,14 @@ void print_bqe (StgBlockingQueueElement *bqe); EMPTY_BLOCKED_QUEUE() && \ EMPTY_SLEEPING_QUEUE()) +#if defined(RTS_SUPPORTS_THREADS) +/* If no task is waiting for a capability, + * spawn a new worker thread. + * + * (Used by the RtsAPI) + */ +void +startSchedulerTask(void); +#endif + #endif /* __SCHEDULE_H__ */