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.
Check rtsSupportsBoundThreads
before.
Also see: How to detect if a program has been compiled using -threaded?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With