diff options
author | Ben Gamari <ben@smart-cactus.org> | 2020-11-01 13:10:24 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2020-11-01 13:10:24 -0500 |
commit | 8325d6585bd1eb440456abcb05a638c44f2aee88 (patch) | |
tree | 772bf37b394969b74a6cc69ce5990f065b0167e6 /rts/Schedule.c | |
parent | a9f75fe23b47358bda585e9af3e2b44da7817c37 (diff) | |
parent | bfbe4366e658035a9182500ae286c71fc1ee54fd (diff) | |
download | haskell-8325d6585bd1eb440456abcb05a638c44f2aee88.tar.gz |
Merge branch 'wip/tsan/timer' into wip/tsan/all
Diffstat (limited to 'rts/Schedule.c')
-rw-r--r-- | rts/Schedule.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/rts/Schedule.c b/rts/Schedule.c index 67177f2d98..28849f32e8 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -2251,6 +2251,12 @@ setNumCapabilities (uint32_t new_n_capabilities USED_IF_THREADS) cap = rts_lock(); task = cap->running_task; + + // N.B. We must stop the interval timer while we are changing the + // capabilities array lest handle_tick may try to context switch + // an old capability. See #17289. + stopTimer(); + stopAllCapabilities(&cap, task); if (new_n_capabilities < enabled_capabilities) @@ -2333,6 +2339,8 @@ setNumCapabilities (uint32_t new_n_capabilities USED_IF_THREADS) // Notify IO manager that the number of capabilities has changed. rts_evalIO(&cap, ioManagerCapabilitiesChanged_closure, NULL); + startTimer(); + rts_unlock(cap); #endif // THREADED_RTS |