GHC supports Concurrent Haskell by default, without requiring a
special option or libraries compiled in a certain way. To get access to
the support libraries for Concurrent Haskell, just import
Control.Concurrent. More information on Concurrent Haskell is provided in the documentation for that module.
Optionally, the program may be linked with
-threaded option (see
Section 4.12.6, “Options affecting linking”. This provides two benefits:
It enables the
-N RTS option to be
used, which allows threads to run in
machine. See Section 4.15, “Using SMP parallelism”.
If a thread makes a foreign call (and the call is
unsafe), then other
Haskell threads in the program will continue to run
while the foreign call is in progress.
Haskell functions may be called from multiple OS
threads simultaneously. See
Section 8.2.4, “Multi-threading and the FFI”.
Sets the context switch interval to
seconds. A context switch will occur at the next heap block
allocation after the timer expires (a heap block allocation occurs
every 4k of allocation). With
-C, context switches will occur as often as
possible (at every heap block allocation). By default, context
switches occur every 20ms.