forkOn# unconditionally context-switches the wrong capability
The current implementation of forkOn#
appears to unconditionally context-switch the current capability. This appears to be copy-pasted from the implementation of fork#
, where such a context switch arguably does make sense since we want to give the new thread a chance to run (although this is arguably too aggressive; see #18224). However, in the case of forkOn#
we should, if anything, be context-switching the capability on which the thread was started, not the current thread.
Edited by Douglas Wilson