Benno

I think that both ought to be ok, but I'd welcome other input.

GHC.runGHC calls initGhcMonad, which allocates an entirely new session (in 
newHscEnv).   So the two will work entirely independently.

Unfortunately that's not 100% true. If you search for GLOBAL_VAR you'll see a 
handful of disgusting global state variables, and they *will* be shared between 
GHC sessions.

There really aren't many.  I'd love someone to eliminate them!  (NB ghc-devs)

Simon

From: ghc-devs [mailto:[email protected]] On Behalf Of Benno 
Fünfstück
Sent: 07 January 2014 13:56
To: ghc-devs
Subject: GHC API: Using runGhc twice or from multiple threads?

Hello,

is the following safe to do?

main = do
  runGhc libdir $ do ...
  runGhc libdir $ do ...

Or will this cause trouble? Is there state that is shared between the two calls?

And what about this one:

main = do
   forkIO $ runGhc libdir $ do ...
   forkIO $ runGhc libdir $ do ...
_______________________________________________
ghc-devs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/ghc-devs

Reply via email to