How to determine if setNumCapabilities will work

Given the following program, with GHC 7.6:

import Control.Concurrent
main = do
    setNumCapabilities 8
    putStrLn "After"

If I create with ghc --makeand run, I get:

main: setNumCapabilities: not supported in the non-threaded RTS
After

The warning about non-threaded RTS is due to what I did not build with -threaded. I would like to change this code so that it doesn't print anything, even if it didn't work. For example, if I could find that RTS was not streaming, I could avoid setNumCapabilities. I do not want to put anything on the performance of the calling program.

+4
source share

Source: https://habr.com/ru/post/1537747/


All Articles