projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[project @ 2003-05-29 12:59:55 by simonmar]
[ghc-hetmet.git]
/
ghc
/
rts
/
Schedule.h
diff --git
a/ghc/rts/Schedule.h
b/ghc/rts/Schedule.h
index
7722802
..
b2a07e4
100644
(file)
--- 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
*
*
* (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);
void awakenBlockedQueue(StgBlockingQueueElement *q, StgClosure *node);
#else
void awakenBlockedQueue(StgTSO *tso);
+#if defined(RTS_SUPPORTS_THREADS)
+void awakenBlockedQueueNoLock(StgTSO *tso);
+#endif
#endif
/* unblockOne()
#endif
/* unblockOne()
@@
-60,9
+63,9
@@
StgTSO *unblockOne(StgTSO *tso);
void raiseAsync(StgTSO *tso, StgClosure *exception);
void raiseAsyncWithLock(StgTSO *tso, StgClosure *exception);
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
*
* 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 */
*/
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.
/* 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);
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(). */
/* Called by shutdown_handler(). */
@@
-174,6
+187,10
@@
typedef struct StgMainThread_ {
StgClosure ** ret;
#if defined(RTS_SUPPORTS_THREADS)
Condition wakeup;
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;
#endif
struct StgMainThread_ *link;
} StgMainThread;
@@
-197,6
+214,8
@@
void print_bq (StgClosure *node);
void print_bqe (StgBlockingQueueElement *bqe);
#endif
void print_bqe (StgBlockingQueueElement *bqe);
#endif
+void labelThread(StgPtr tso, char *label);
+
/* -----------------------------------------------------------------------------
* Some convenient macros...
*/
/* -----------------------------------------------------------------------------
* Some convenient macros...
*/
@@
-255,9
+274,7
@@
void print_bqe (StgBlockingQueueElement *bqe);
*/
#if defined(RTS_SUPPORTS_THREADS)
#define THREAD_RUNNABLE() \
*/
#if defined(RTS_SUPPORTS_THREADS)
#define THREAD_RUNNABLE() \
- if ( !noCapabilities() ) { \
- signalCondition(&thread_ready_cond); \
- } \
+ wakeBlockedWorkerThread(); \
context_switch = 1;
#else
#define THREAD_RUNNABLE() /* nothing */
context_switch = 1;
#else
#define THREAD_RUNNABLE() /* nothing */
@@
-275,4
+292,14
@@
void print_bqe (StgBlockingQueueElement *bqe);
EMPTY_BLOCKED_QUEUE() && \
EMPTY_SLEEPING_QUEUE())
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__ */
#endif /* __SCHEDULE_H__ */