summaryrefslogtreecommitdiff
path: root/libraries/base/GHC/ConsoleHandler.hs
diff options
context:
space:
mode:
authorSimon Marlow <simonmar@microsoft.com>2006-12-05 15:49:27 +0000
committerSimon Marlow <simonmar@microsoft.com>2006-12-05 15:49:27 +0000
commitcf2d0bf9824b534483bf6e413122d625e236430d (patch)
tree4b59bd5e3d030d09bf8fe2597021f1d6711331be /libraries/base/GHC/ConsoleHandler.hs
parent8c741ae37ec3724f82c18d5d0720fd9a3c316e2b (diff)
downloadhaskell-cf2d0bf9824b534483bf6e413122d625e236430d.tar.gz
documentation for installHandler
merge to 6.6
Diffstat (limited to 'libraries/base/GHC/ConsoleHandler.hs')
-rw-r--r--libraries/base/GHC/ConsoleHandler.hs19
1 files changed, 19 insertions, 0 deletions
diff --git a/libraries/base/GHC/ConsoleHandler.hs b/libraries/base/GHC/ConsoleHandler.hs
index 7435b92dab..3c3d2f4b5b 100644
--- a/libraries/base/GHC/ConsoleHandler.hs
+++ b/libraries/base/GHC/ConsoleHandler.hs
@@ -52,6 +52,25 @@ data ConsoleEvent
| Shutdown
deriving (Eq, Ord, Enum, Show, Read, Typeable)
+-- | Allows Windows console events to be caught and handled. To
+-- handle a console event, call 'installHandler' passing the
+-- appropriate 'Handler' value. When the event is received, if the
+-- 'Handler' value is @Catch f@, then a new thread will be spawned by
+-- the system to execute @f e@, where @e@ is the 'ConsoleEvent' that
+-- was received.
+--
+-- Note that console events can only be received by an application
+-- running in a Windows console. Certain environments that look like consoles
+-- do not support console events, these include:
+--
+-- * Cygwin shells with @CYGWIN=tty@ set (if you don't set @CYGWIN=tty@,
+-- then a Cygwin shell behaves like a Windows console).
+-- * Cygwin xterm and rxvt windows
+-- * MSYS rxvt windows
+--
+-- In order for your application to receive console events, avoid running
+-- it in one of these environments.
+--
installHandler :: Handler -> IO Handler
installHandler handler =
alloca $ \ p_sp -> do