Proposal: System.Timeout module for base

Simon Marlow simonmarhaskell at
Thu Feb 15 05:42:40 EST 2007

Bulat Ziganshin wrote:
> Hello Simon,
> Thursday, February 1, 2007, 12:46:29 PM, you wrote:
>> Any other suggestions?
> may be, we can raise exception in foreign language? at least for
> 'safe' calls. i.e., we establish in RTS signal handler. this handler
> checks whether we are performing safe call and if so - raise
> language-specific exception... hmm, if that's possible

There's no way to raise an exception in C, in general.

> 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.


More information about the Libraries mailing list