Comments
Loading Dream Comments...
You must be logged in to write a comment - Log In
For example, suppose we want to catch a divide exception, a terminated thread exception, and a "Sense Switch Interrupt" (Alt-SysRq) event.
{? DIV0 : &{ttyout ("Division by zero"); quit();};
BUFHUNG : &{ttyout("Buffer owner has exited, reader thread halted"); quit();};
ALTSYSRQ : &{ttyout("User pressed sense switch");} ?};
The "{? ... ?}" block serves the dual purpose of a catch() block and an event wait (WT$LAN, WT$LOR, WT$SIG) block. It calls a lambda asynchronously (an AST, asynchronous system trap) when an "expected" (as in Maximop) event occurs, and cascades to an outermost "catch all" handler when an "unexpected" event occurs.