try
$foo();
except e (ANY, 1, 100)
$command_utils:suspend_if_needed(0);
/* error handling */
endtry
In this case, the $foo() verb has 1 second and 100 ticks LESS total before it
times out, at which point control will return to the exception (which also
handles any error, in this example) which immediately suspends (if needed)
before handling the error or timeout.
This allows webservers (and similar things) to do more graceful cleanup of the
request.
Possible problem:
- Giving non-wizard tasks the ability to manipulate the maximum time/ticks of
the verbs they call could lead to security issues (think of setting it so a
money-transfer verb times out right after it deducts from PlayerA's balance,
but before it adds to PlayerB's...)
Thoughts/suggestions?
I wonder if it might be easier to have a builtin along the line of
set_timeout(...) that initiates a VM state that will track the clock
and throw the exception. I'm not entirely sure which makes more sense
internally, but I'd want something more expressive. Alternately,
perhaps:
except e (ANY) until (1, 100)
or
except e (ANY)
...
timeout (1, 100)
...
What would stop someone from chaining them to get effectively infinite
ticks/seconds?
How about a "when a timeout happens, your verb WILL suspend before the handler
executes" rule? ;)
Todd
On Dec 1, 11:01 pm, "Luke-Jr" <l...@dashjr.org> wrote: