/* ---------------------------------------------------------------------------
- * $Id: Schedule.c,v 1.70 2000/05/08 15:57:01 simonmar Exp $
+ * $Id: Schedule.c,v 1.74 2000/08/03 11:28:35 simonmar Exp $
*
* (c) The GHC Team, 1998-2000
*
}
/* check for signals each time around the scheduler */
-#ifndef __MINGW32__
+#ifndef mingw32_TARGET_OS
if (signals_pending()) {
start_signal_handlers();
}
cap->rCurrentTSO = t;
- /* set the context_switch flag
+ /* context switches are now initiated by the timer signal, unless
+ * the user specified "context switch as often as possible", with
+ * +RTS -C0
*/
- if (run_queue_hd == END_TSO_QUEUE)
- context_switch = 0;
+ if (RtsFlags.ConcFlags.ctxtSwitchTicks == 0
+ && (run_queue_hd != END_TSO_QUEUE
+ || blocked_queue_hd != END_TSO_QUEUE))
+ context_switch = 1;
else
- context_switch = 1;
+ context_switch = 0;
RELEASE_LOCK(&sched_mutex);
ACQUIRE_LOCK(&sched_mutex);
IF_DEBUG(scheduler,
- sched_belch("thread %d did a _ccall_gc\n", cap->rCurrentTSO->id));
+ sched_belch("thread %d did a _ccall_gc", cap->rCurrentTSO->id));
threadPaused(cap->rCurrentTSO);
cap->rCurrentTSO->link = suspended_ccalling_threads;
context_switch = 0;
interrupted = 0;
+ RtsFlags.ConcFlags.ctxtSwitchTicks =
+ RtsFlags.ConcFlags.ctxtSwitchTime / TICK_MILLISECS;
+
#ifdef INTERPRETER
ecafList = END_ECAF_LIST;
clearECafTable();