summaryrefslogtreecommitdiff
path: root/rts/Schedule.c
diff options
context:
space:
mode:
authorDouglas Wilson <douglas.wilson@gmail.com>2022-07-12 16:04:42 +0100
committerDouglas Wilson <douglas.wilson@gmail.com>2022-07-13 15:55:23 +0100
commit9751d27694f3e16ec765dba2ceb795633c7aba90 (patch)
treeb65cf08b9323019d63bbb30f1a5fef1f8384e324 /rts/Schedule.c
parent8b417ad54a91a7e12671cf059e0b5a3be43bbce2 (diff)
downloadhaskell-wip/dougwilson/21824.tar.gz
rts: forkOn context switches the target capabilitywip/dougwilson/21824
Fixes #21824
Diffstat (limited to 'rts/Schedule.c')
-rw-r--r--rts/Schedule.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/rts/Schedule.c b/rts/Schedule.c
index 0a75bd1a55..fa0fc8c63e 100644
--- a/rts/Schedule.c
+++ b/rts/Schedule.c
@@ -2586,6 +2586,9 @@ scheduleThreadOn(Capability *cap, StgWord cpu USED_IF_THREADS, StgTSO *tso)
{
tso->flags |= TSO_LOCKED; // we requested explicit affinity; don't
// move this thread from now on.
+
+ // We will context switch soon, but not immediately: we don't want every
+ // fork to force a context-switch.
#if defined(THREADED_RTS)
cpu %= enabled_capabilities;
if (cpu == cap->no) {
@@ -2593,8 +2596,10 @@ scheduleThreadOn(Capability *cap, StgWord cpu USED_IF_THREADS, StgTSO *tso)
} else {
migrateThread(cap, tso, capabilities[cpu]);
}
+ contextSwitchCapability(capabilities[cpu], false);
#else
appendToRunQueue(cap,tso);
+ contextSwitchCapability(cap, false);
#endif
}