[GHC] #4504: "awaitSignal Nothing" does not block thread with -threaded

GHC cvs-ghc at haskell.org
Wed Dec 8 12:28:39 CET 2010


#4504: "awaitSignal Nothing" does not block thread with -threaded
---------------------------------+------------------------------------------
    Reporter:  adept             |        Owner:  adept                      
        Type:  bug               |       Status:  patch                      
    Priority:  normal            |    Milestone:  7.2.1                      
   Component:  Runtime System    |      Version:  7.0.1                      
    Keywords:                    |     Testcase:                             
   Blockedby:                    |   Difficulty:                             
          Os:  Unknown/Multiple  |     Blocking:                             
Architecture:  Unknown/Multiple  |      Failure:  Incorrect result at runtime
---------------------------------+------------------------------------------

Comment(by adept):

 Or, let me put it this way: {{{awaitSignal}}} should provide a convenient
 interface to {{{sigsuspend}}}, right?

 AFAIK, in C land the most common use cases for {{{sigsuspend}}} is to set
 up some signal handlers and then either:

 1. Block until any of the signals arrive (using empty signal mask)

 2. Block until one of the subset of the handled signals arrive (using non-
 empty signal mask)


 For the latter, we have {{{awaitSignal (Just someMask)}}}. For former, we
 have nothing. Rather we have a "honey trap" - if the programmer uses
 {{{awaitSignal  Nothing}}}, his code will behave strangely with
 "-threaded" without any indication of what went wrong.

 Hence I propose to restore the utility of {{{awaitSignal Nothing}}} via
 masking the scheduler signal away, more or less like the proposed patch
 does.

 On the other hand, we should export {{{reservedSignals}}} like you
 proposed so that programmers may check '''when setting signal handlers'''
 if they are likely to step on RTS toes.

 How does this sound?

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



More information about the Glasgow-haskell-bugs mailing list