Some problems writing a threaded program

Don Stewart dons at galois.com
Sun Feb 10 22:28:46 EST 2008


jpvogel1:
>    I am running my program in WinXP with ghc 2.6.8
> 
>    If you install netstat and change the parameters it should still work in
>    linux.
> 
>    Why does thread # 3 dominate over the over threads int the output?
>    Why does thread # 4 never seem to run?
> 
>    I can't use the sleep function in System.Process.Win32 since it puts all
>    the
>    threads asleep at the same time.  Is there a way to put only one thread
>    asleep?
> 
>    That would allow more of a chance for thread #4 to run.

There is 'threadDelay' and 'yield' if you need to either sleep a thread,
or explicitly trigger a scheduler event.

http://haskell.org/ghc/docs/latest/html/libraries/base/Control-Concurrent.html#4


More information about the Glasgow-haskell-users mailing list