Default options for -threaded

Ben Gamari ben at
Mon Oct 10 13:33:43 UTC 2016

Phyx <lonetiger at> writes:

> Oops, sorry, only just now seen this. It seems my overly aggressive filters
> couldn't decide where to put the email :)
> I do agree to some extend with this. I'd prefer if I made a mistake for my
> system not to hang. The one downside to this default though is that you
> can't just hand a program over to user and have it run at full capabilities.
> If it possible to set this from inside a program? My guess is no, since by
> the time you get to main the rts is already initialized?
> Would a useful alternative be to provide a compile flag that would change
> the default? e.g. opt-in? Since now there is a small burden on the end user.
There exist two pretty good tools for accomplishing what you want,

 1. Call Control.Concurrent.setNumCapabilities [1] from within your
 2. Use GHC's -with-rtsopts flag [2] to set the default RTS arguments
    during compilation of your application.


- Ben

[1] http://localhost:7000/file/opt/exp/ghc/roots/8.0.1/share/doc/ghc-8.0.1/html/libraries/base-
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 454 bytes
Desc: not available
URL: <>

More information about the ghc-devs mailing list