GHC API: Using runGhc twice or from multiple threads?

Manuel M T Chakravarty chak at cse.unsw.edu.au
Fri Jan 24 01:38:01 UTC 2014


Simon Marlow <marlowsd at gmail.com>:
>> And what about this one:
>> 
>> main = do
>>    forkIO $ runGhc libdir $ do ...
>>    forkIO $ runGhc libdir $ do ...
> 
> The problem with this is the RTS linker, which is a single piece of shared global state.  We could actually fix that if it became important.  If you’re not running interpreted code, this should be fine (apart from the static flags issue mentioned above).

I’m curious, what is the issue with interpreted code? Does the interpreter store interpreter state in the RTS, which would get mixed up between the two instances?

If so, wouldn’t the same thing happen if I use forkIO in interpreted code?

Manuel



More information about the ghc-devs mailing list