Hi again,

I have tried to play around with MVar today, but
still... I did not see how to synchronize MVar without
the help of forkIO, and then explicitly call yield ::
IO (). But then, if I use forkIO I will create "daemon
threads" that will cause my program to terminates
immediately (back to the original problem).

I attached the source code to this email.

ps: If you can tell the depth of my understanding of
concurrent Haskell from my code, please do not
hesitate to evaluate it (Eg. am I using MVar
correctly? Any better method? etc.), since I am really
new to concurrent Haskell. Thanks.

Again, thank you for the help.


Sincerely,

Dennis Sidharta



--- Sven Panne <[EMAIL PROTECTED]>
wrote:
> Dennis Sidharta wrote:
> > [ problems with concurrent Haskell ]
> 
> I can see two problems in your code:
> 
> * forkIO creates "daemon threads", so the program
> terminates immediately.
> 
> * Chan is an unbounded channel, so you won't get a
> "ping pong", which
>    is probably what you expected. MVar is your
> friend here.
> 
> See
>
http://haskell.org/ghc/docs/latest/html/base/Control.Concurrent.html
> 
> Cheers,
>     S.
> 
> 

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

Attachment: mySource.hs
Description: mySource.hs

Reply via email to