#5784: Forked thread running infinite loop blocks other threads from running
-----------------------------------------+----------------------------------
 Reporter:  joeyadams                    |          Owner:                
     Type:  bug                          |         Status:  new           
 Priority:  normal                       |      Component:  Runtime System
  Version:  7.2.2                        |       Keywords:                
       Os:  Linux                        |   Architecture:  x86_64 (amd64)
  Failure:  Incorrect result at runtime  |       Testcase:                
Blockedby:                               |       Blocking:                
  Related:                               |  
-----------------------------------------+----------------------------------
Changes (by kmcallister):

 * cc: mcallister.keegan@… (added)


Comment:

 Note that the `main` thread is a `forkOS`-style bound thread:

 {{{
 $ cat foo.hs
 import Control.Concurrent
 main = isCurrentThreadBound >>= print

 $ ghc -threaded foo.hs && ./foo
 [1 of 1] Compiling Main             ( foo.hs, foo.o )
 Linking foo ...
 True
 }}}

 In your example, if I rename `main` to `main'` and set

 {{{
 main = forkIO main' >> forever (threadDelay maxBound)
 }}}

 then I do see the `"Forked "` message.

 Perhaps the non-allocating loop is monopolizing the specific OS thread
 where `main` is bound.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5784#comment:4>
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

Reply via email to