Re: synchronizing MVar ( was compiling concurrent haskell with ghc )

2003-07-30 Thread Dennis Sidharta
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

mySource.hs
Description: mySource.hs


Re: compiling concurrent haskell with ghc

2003-07-28 Thread Dennis Sidharta

Hi Keith,

With this email I attached the source code. As you can see, it is very simple. And in case you would like to know, I wrote that program for a short tutorial on Haskell for a programming language courseI took last semester.

Thank you very much.


Blessings,

Dennis
Keith Wansbrough [EMAIL PROTECTED] wrote:

 Hi all,  I have a question on compiling a concurrent haskell source code using GHC. Today is my first time playing around with concurrency in Haskell, and this afternoon, GHC seemed to be able to compile my code and produced an executable. However, that executable did not seem to run the program correctly. In fact, it just did not do anything. FYI, GHCi interpreted the code succesfully, and the program runs normally under GHCi.  I compiled the code this way: ghc --make source.hs -o outputPlease post the code, a description of what it did, and what youexpected it to do. If the code is too large for an email, put it onyour web server and point us at it, or cut it down to a smallerversion that still exhibits the problem, and include that. We can'thelp you if we don't have
 this information.--KW 8-)___Haskell-Cafe mailing list[EMAIL PROTECTED]http://www.haskell.org/mailman/listinfo/haskell-cafe
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software

mySource.hs
Description: mySource.hs


Re: compiling concurrent haskell with ghc

2003-07-28 Thread Dennis Sidharta
Hi Sven,

Thanks for the pointer! I will try to play around with MVar.


Sincerely,

DennisSven 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", whichis probably what you expected. MVar is your friend here.See http://haskell.org/ghc/docs/latest/html/base/Control.Concurrent.htmlCheers,S.
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software

compiling concurrent haskell with ghc

2003-07-27 Thread Dennis Sidharta
Hi all,

I have a question on compiling a concurrent haskell source code using GHC. Today is my first time playing around with concurrency in Haskell, and this afternoon, GHC seemed to be able to compile my code and produced an executable. However, that executable did not seem to run the program correctly. In fact, it justdid not do anything. FYI, GHCi interpreted the code succesfully, and the program runs normally under GHCi.

I compiledthe codethis way:
ghc --make source.hs -o output

Do I need to have a specific flag or something? I tried to look atGHC's documentation, but I just could not find any information on thisexcept adding -syslib concurrent flag, which also did not help.

Thank you very much for the help.


Blessings,

Dennis Sidharta
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software