Commit b9f9670c authored by Ben Gamari's avatar Ben Gamari 🐢
Browse files

rts: Ensure that new capability count is > 0

The Haskell wrapper already checks this but we should also check it in the RTS
to catch non-Haskell callers. See #13832.
parent df328800
......@@ -2178,7 +2178,13 @@ setNumCapabilities (uint32_t new_n_capabilities USED_IF_THREADS)
Capability *old_capabilities = NULL;
uint32_t old_n_capabilities = n_capabilities;
if (new_n_capabilities == enabled_capabilities) return;
if (new_n_capabilities == enabled_capabilities) {
} else if (new_n_capabilities <= 0) {
errorBelch("setNumCapabilities: Capability count must be positive");
debugTrace(DEBUG_sched, "changing the number of Capabilities from %d to %d",
enabled_capabilities, new_n_capabilities);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment