문제

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.

도움이 되었습니까?
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top