raising exceptions for signals
Simon Marlow
simonmarhaskell at gmail.com
Mon Feb 19 08:29:23 EST 2007
Bulat Ziganshin wrote:
>>> btw, how about using for *Haskell* code *default* signal handler that
>>> raise Haskell exception? i think that using signal handlers to process
>>> OS-generated events is just legacy from the C days. i.e. 'main'
>>> should be called by RTS inside code like this:
>>>
>>> mainThread <- myThreadId
>>> let onBreak event = do
>>> throwTo mainThread BreakException
>>> bracket (installHandler$ Catch onBreak) (installHandler) $ \oldHandler -> do
>>> main
>>>
>>> (of course, this handles only ^Break and only on Windows)
>>>
>>> among other things, this should make signal handling portable between
>>> Win/Unix
>
>> Yes, we've discussed this in the past (e.g. there was a thread about this on the
>> haskell-prime list). I'm definitely in favour of doing something along these lines.
>
> how about adding such facility to ghc HEAD? i can write initial
> windows implementation and put it to discussion here or in ghc
> maillist
I don't have a clear idea for the design, I'd have to go back and look at the
haskell prime discussion. Do you want to propose something?
Cheers,
Simon
More information about the Libraries
mailing list