[Haskell-cafe] Re: Profiling and Threading: never the twain shall meet

Simon Marlow simonmarhaskell at gmail.com
Tue Jul 24 04:31:08 EDT 2007


Dougal Stanton wrote:

> It seems that profiling and threading are not supported at the same
> time in GHC6.6. At least, it objects to using both the flags at the
> same time, and there's a Trac entry for that issue.
> 
> So I just wanted to be sure that I really need threading. I'm passing
> text through some filters written in perl, just ordinary command line
> programs. I do it like this:
> 
>> do
>>   (hin, hout, herr, ph) <- runInteractiveProcess cmd args Nothing Nothing
>>   forkIO $ hPutStr hin content >> hClose hin
>>   out <- hGetContents hout
>>   return (ph, out)
> 
> which seems to require threading. If I compile without, it will hang
> indefinitely, I presume deadlocked. Is there a way this can be done
> without threading?

You certainly can use threading with profiling, just not the "threaded RTS" 
that you get with the -threaded option.  There are certain restrictions 
that apply when you don't use -threaded, but ordinary forkIO works fine.

http://www.haskell.org/ghc/docs/latest/html/users_guide/options-phases.html#options-linker

Cheers,
	Simon


More information about the Haskell-Cafe mailing list