scheduleWaitThread(): don't call THREAD_RUNNABLE because the new
thread is bound, and therefore only runnable by the current OS
thread. Calling THREAD_RUNNABLE just wakes up workers and slows
things down.
/* ---------------------------------------------------------------------------
/* ---------------------------------------------------------------------------
- * $Id: Schedule.c,v 1.188 2004/02/26 16:19:32 simonmar Exp $
+ * $Id: Schedule.c,v 1.189 2004/02/27 12:39:16 simonmar Exp $
*
* (c) The GHC Team, 1998-2003
*
*
* (c) The GHC Team, 1998-2003
*
scheduleThread_(StgTSO *tso)
{
// Precondition: sched_mutex must be held.
scheduleThread_(StgTSO *tso)
{
// Precondition: sched_mutex must be held.
-
- /* Put the new thread on the head of the runnable queue. The caller
- * better push an appropriate closure on this thread's stack
- * beforehand. In the SMP case, the thread may start running as
- * soon as we release the scheduler lock below.
- */
PUSH_ON_RUN_QUEUE(tso);
THREAD_RUNNABLE();
PUSH_ON_RUN_QUEUE(tso);
THREAD_RUNNABLE();
-
-#if 0
- IF_DEBUG(scheduler,printTSO(tso));
-#endif
-void scheduleThread(StgTSO* tso)
+void
+scheduleThread(StgTSO* tso)
{
ACQUIRE_LOCK(&sched_mutex);
scheduleThread_(tso);
{
ACQUIRE_LOCK(&sched_mutex);
scheduleThread_(tso);
m->link = main_threads;
main_threads = m;
m->link = main_threads;
main_threads = m;
+ PUSH_ON_RUN_QUEUE(tso);
+ // NB. Don't call THREAD_RUNNABLE() here, because the thread is
+ // bound and only runnable by *this* OS thread, so waking up other
+ // workers will just slow things down.
return waitThread_(m, initialCapability);
}
return waitThread_(m, initialCapability);
}