#2892: (threadDelay (-1)) hangs
----------------------+-----------------------------------------------------
Reporter: dancor | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.10.1
Severity: normal | Resolution:
Keywords: | Testcase:
Os: Linux | Architecture: x86
----------------------+-----------------------------------------------------
Comment (by dancor):
Very sorry, here is the description with proper formatting:
threadDelay silently hangs forever given a negative delay interval. It
seems like this should at least be documented, but further is probably
suboptimal magical behavior that leads to harder-to-find bugs; instead
this should be an error. Conceivably threadDelay could take Maybe Int but
that seems kind of out there.
Here is some discussion from #haskell:
{{{
06:39 < dancor> do other ppl agree that (threadDelay (-1)) hanging
silently is
bug?
06:39 < dancor> i guess you might want infinite hang, hm
06:39 < Cale> dancor: I think I might agree with that, though now that you
mention it, it's very handy.
06:39 < Cale> dancor: A lot of things which would cause a thread to block
forever will throw an exception and kill the thread.
06:40 < Cale> (an exception which you'd often wish were silent)
06:40 < Cale> But threadDelay is the wrong place for that
06:40 < b_jonas> dancor: yeah, the thread should just be garbage-collected
06:42 * quicksilver uses "forever (threadDelay maxBound)"
}}}
I'm on Debian lenny:
{{{
~ uname -a
Linux pima 2.6.26-1-686-bigmem #1 SMP Sat Nov 8 19:46:36 UTC 2008 i686
GNU/Linux
~ ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.10.1
~ cat threadHang.hs
import Control.Concurrent
main = threadDelay (-1)
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2892#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs