[Haskell-cafe] forkIO on GHCI does not seem to spawn the thread in the background on some OSs
C K Kashyap
ckkashyap at gmail.com
Tue Feb 8 16:16:23 CET 2011
> I can't reproduce this. What are you using as the action?
> I've tried bottoms, and tight loops whose Core contains no allocations, and
> managed to lock up the prompt, or seen ghci using more threads than I have
> One thing that may give the appearance of locking up the prompt is if
> the thread starts reading from the terminal and your commands no longer
> make it
> to the interpreter.
> > It is not always a thread. ForkIO creates a spark and then the
> > scheduler decides when sparks should be scheduled to threads. Thus
> > you get a guarantee of concurrent but not parallel execution.
> That is not correct - it is "par" that creates sparks may be discarded.
> forkIO always creates new threads, though it is of course up to the
> when the threads are executed, and how many cores are used.
> > Are you running with threads enabled?
> That is, was your ghci compiled with -threaded? This mostly
> depends on the version. what version of ghc are you running, and how did
> install it?
> Sorry ... extremely sorry ... my bad ... for some reason, I was omitting
the call to forkIO :( when I was trying on other platforms.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe