[GHC] #7934: usleep hangs, no threads

GHC cvs-ghc at haskell.org
Sun May 26 00:37:40 CEST 2013


#7934: usleep hangs, no threads
----------------------------------------+-----------------------------------
Reporter:  gelisam                      |          Owner:                
    Type:  bug                          |         Status:  new           
Priority:  normal                       |      Component:  Runtime System
 Version:  7.4.2                        |       Keywords:                
      Os:  MacOS X                      |   Architecture:  x86_64 (amd64)
 Failure:  Incorrect result at runtime  |      Blockedby:                
Blocking:                               |        Related:  1156          
----------------------------------------+-----------------------------------
 import System.Posix.Unistd
 main = flip mapM_ [0..] $ \i -> do
          usleep 100000
          print i

 ===

 The above program hangs after a variable number of iterations (usually
 around 120, sometimes up to 200, often before the first call to print).

 The documentation for usleep warns about bad interactions with threads,
 but the above program doesn't use any.

 The problem also occurs with nanosleep, but not with threadDelay.

 #1156 sounds related, but this time the problem also occurs without
 -threaded.

 ===

 workaround: use threadDelay.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7934>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the ghc-tickets mailing list