[Haskell-cafe] Possible bug in Control.Concurrent

2011-02-09 Thread Krzysztof Skrzętnicki
Hello Cafe, Here is a simple program that yields strange results: module Main where import Control.Concurrent import Control.Concurrent.Chan import Control.Monad main = do c - newChan writeChan c 1 forkIO $ forever $ do i - readChan c print (forkio,i) isEmptyChan c = print First of

Re: [Haskell-cafe] Possible bug in Control.Concurrent

2011-02-09 Thread Krzysztof Skrzętnicki
Shame on me, I forgot to include the software versions I use: $ ghc --version The Glorious Glasgow Haskell Compilation System, version 6.12.3 $ uname -a Linux raptor 2.6.37-ARCH #1 SMP PREEMPT Sat Jan 29 20:00:33 CET 2011 x86_64 Intel(R) Core(TM) i7 CPU 870 @ 2.93GHz GenuineIntel GNU/Linux This

Re: [Haskell-cafe] Possible bug in Control.Concurrent

2011-02-09 Thread Neil Brown
On 09/02/11 15:34, Krzysztof Skrzętnicki wrote: Hello Cafe, Here is a simple program that yields strange results: module Main where import Control.Concurrent import Control.Concurrent.Chan import Control.Monad main = do c - newChan writeChan c 1 forkIO $ forever $ do i - readChan c

Re: [Haskell-cafe] Possible bug in Control.Concurrent

2011-02-09 Thread Holger Reinhardt
You've been bitten by the following bug: http://hackage.haskell.org/trac/ghc/ticket/4154 In short, isEmptyChan will block because of the concurrent call to readChan. The solution is to not use isEmptyChan or switch to STM. 2011/2/9 Krzysztof Skrzętnicki gte...@gmail.com Hello Cafe, Here is