- 22 Apr, 2005 2 commits
-
-
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.
-
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.
-
- 21 Jan, 2005 1 commit
-
-
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.
-
- 17 Nov, 2004 1 commit
-
-
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 --
-
- 14 Sep, 2004 1 commit
-
-
mthomas authored
Replace prog_belch with errorBelch.
-
- 19 Aug, 2004 1 commit
-
-
simonmar authored
Windows fixes.
-
- 21 Oct, 2003 1 commit
-
-
sof authored
stg_InstallConsoleEvent(): registering generic_handler() once will do
-
- 20 Oct, 2003 1 commit
-
-
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.
-