Question

Given the following program, with GHC 7.6:

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

If I build with ghc --make and run I get:

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

The warning about the non-threaded RTS comes because I didn't build with -threaded. I would like to modify this code so that it doesn't print anything even if it didn't work. For example, if I could detect that the RTS was non-threaded, then I could avoid the setNumCapabilities. I don't want to put something on the stdout of the calling program.

Was it helpful?
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top