#4942: GHC.ConsoleHandler does not call back application when Close button is
pressed
------------------------+---------------------------------------------------
    Reporter:  Amatic   |        Owner:                             
        Type:  bug      |       Status:  new                        
    Priority:  normal   |    Milestone:  7.4.1                      
   Component:  GHC API  |      Version:  6.12.3                     
    Keywords:           |     Testcase:                             
   Blockedby:           |   Difficulty:                             
          Os:  Windows  |     Blocking:                             
Architecture:  x86      |      Failure:  Incorrect result at runtime
------------------------+---------------------------------------------------

Comment(by fryguybob):

 I tried making the `generic_handler` handle CTRL_CLOSE_EVENT like the
 other events, except not returning when it encountering CTRL_CLOSE_EVENT,
 CTRL_LOGOFF_EVENT, or CTRL_SHUTDOWN_EVENT and making
 `rts_ConsoleHandlerDone` end the process with
 `stg_exit(EXIT_INTERRUPTED)`.  This appeared to work nicely for the code
 above when not using `-threaded`.  But there are still some of things to
 work out:

     * If there isn't a handler installed, `rts_ConsoleHandlerDone` isn't
 called.  So in this case we should return `FALSE` from `generic_handler`.
 I don't think there is a reliable way to detect this right now.
     * The threaded runtime doesn't call `rts_ConsoleHandlerDone` but I
 think that it could be easily changed.
     * What is the correct way to not return from `generic_handler` (in my
 experiment I did `Sleep(INFINITE)`)?
     * What is the correct way to terminate the process in
 `rts_ConsoleHandlerDone`?  Perhaps `generic_handler` should wait on an
 event that is always set when there is no handler and gets set in
 `rts_ConsoleHandlerDone` otherwise.

 Anyway, perhaps someone more experience than me can chime in.

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