[Haskell-cafe] Question on concurrency

Arnaud Bailly arnaud.oqube at gmail.com
Tue Sep 14 06:25:31 EDT 2010


Probably did not test enough. Sorry for the noise.

arnaud

On Tue, Sep 14, 2010 at 12:18 PM, Neil Brown <nccb2 at kent.ac.uk> wrote:
> On 14/09/10 07:45, Arnaud Bailly wrote:
>>
>> What surprised me is that I would expect the behaviour of the two
>> functions to be different:
>>  - in doRunMvnInIO, I would expect stdout's content to be printed
>> before stderr, ie. the 2 threads are ordered because I call takeMVar
>> in between calls to forkIO
>>  - in doRunMvnInIO', this is not true and both theads run concurrently.
>>
>> but actually there does not seem to be a difference: printing is still
>> interleaved in both functions, AFAICT.
>>
>>
>
> Hi,
>
> I've tried your code (substituting a program that spits out different
> streams of numbers on stdout and stderr for maven), and I see the behaviour
> you had expected: the first version does print all of stdout before stderr,
> whereas the second version shows interleaving of the two streams.  Are you
> certain that you are seeing interleaving in the first version?
>
> Thanks,
>
> Neil.
>
>


More information about the Haskell-Cafe mailing list