1. 22 Apr, 2005 2 commits
    • sof's avatar
      [project @ 2005-04-22 17:50:13 by sof] · fbf16357
      sof authored
      Switch to a manual-reset event for the completed-console-event object;
      with auto-reset, we ran the risk of leaving it in a signalled state.
      
      Merge to STABLE.
      fbf16357
    • sof's avatar
      [project @ 2005-04-22 17:00:48 by sof] · ecb1a539
      sof authored
      [mingw only]
      Better handling of I/O request abortions upon throwing an exception
      to a Haskell thread. As was, a thread blocked on an I/O request was
      simply unblocked, but its corresponding worker thread wasn't notified
      that the request had been abandoned.
      
      This manifested itself in GHCi upon Ctrl-C being hit at the prompt -- the
      worker thread blocked waiting for input on stdin prior to Ctrl-C would
      stick around even though its corresponding Haskell thread had been
      thrown an Interrupted exception. The upshot was that the worker would
      consume the next character typed in after Ctrl-C, but then just dropping
      it. Dealing with this turned out to be even more interesting due to
      Win32 aborting any console reads when Ctrl-C/Break events are delivered.
      
      The story could be improved upon (at the cost of portability) by making
      the Scheduler able to abort worker thread system calls; as is, requests
      are cooperatively abandoned. Maybe later.
      
      Also included are other minor tidyups to Ctrl-C handling under mingw.
      
      Merge to STABLE.
      ecb1a539
  2. 21 Jan, 2005 1 commit
    • sof's avatar
      [project @ 2005-01-21 19:58:51 by sof] · c7fd6356
      sof authored
      win32 only:
        Tidy up delivery and handling of console events by having the low-level
        console event handler signal the RTS thread blocked waiting for I/O.
      c7fd6356
  3. 17 Nov, 2004 1 commit
    • sof's avatar
      [project @ 2004-11-17 19:07:38 by sof] · 900ca61d
      sof authored
      Expose Win32 console event handling to the user.
      
      Added RTS support for registering and delivering console events quite
      a while ago (rts/win32/ConsoleHandler.c), but got bored with it before
      completing the job. Here's the concluding commit; it does the following:
      
      - new module, base/GHC/ConsoleHandler.hs which supports registering of
        console event handlers (the null module on plats other than mingw).
      - special handling of aborted async read()s on 'standard input' in
        rts/win32/IOManager.c (together with GHC.Conc.asyncRead). See comments
        in that IOManager.c as to why this is needed.
        [ Any other code that performs blocking I/O on 'standard input' will
          need to be tweaked too to be console event handler/signal friendly.]
      - for now, disable the delivery of 'close' events (see
        rts/win32/ConsoleHandler.c:generic_handler() for reasons why)
      
      Feel free to hoik GHC/ConsoleHandler.hs around the lib hierarchy to wherever
      is considered more fitting. Unifying functionality between System.Posix.Signals
      and GHC.ConsoleHandler is one (obvious) thing to do.
      
      -- Demonstrating GHC.ConsoleHandler use; win32 only
      module Main(main) where
      
      import GHC.ConsoleHandler
      import System.IO  (hFlush, stdout)
      import GHC.Conc   (threadDelay)
      
      main :: IO ()
      main = do
        installHandler (Catch (\ _ -> putStrLn "Caught console event; ignoring" >> hFlush stdout))
        loop
       where
        loop = do
          threadDelay 100000
          ls <- getLine
          putStrLn ls
          loop
      --
      900ca61d
  4. 14 Sep, 2004 1 commit
  5. 19 Aug, 2004 1 commit
  6. 21 Oct, 2003 1 commit
  7. 20 Oct, 2003 1 commit
    • sof's avatar
      [project @ 2003-10-20 17:15:27 by sof] · d0c6e4ec
      sof authored
      Console event handling support (i.e., Haskell-side support for SIGINT under win32).
      
      win32/ConsoleHandler.h implements the Signals.h API. No library support
      for installing user event handlers included in this commit.
      d0c6e4ec