TimeOut not working as hoped/expected
I had hoped to use the "time out" feature in a loop similar to this:
for i := 1 to 1000 do I := RandomIdeal(...); try GB := GBasisTimeout(I, 5.0); UponError E do /*nothing*/ EndTry; ... endfor;
Unfortunately as currently implemented the "time out" causes an interrupt (like Ctrl-C) rather than a normal error; so control leaves the try block whenever a time out occurs...
#2 Updated by Anna Maria Bigatti 11 months ago
- % Done changed from 0 to 10
John Abbott wrote:
Is a "timeout" more like an interrupt (which cannot be caught by a try block)?
Or is it more like an error (which can be caught by a try block)?
My first thought was it should be like an interrupt ("interrupt after ..seconds"),
but I see it could be viewed similarly to the "insufficient precision" error.
The question is: how can we detect the computation finished?
One easy way is this (probably easier than try/catch for the common user):
UnsetValue := 145692761358726487564386; -- whatever object GB := UnsetValue; GB := GBasisTimeout(I, 10); if GB <> UnsetValue then ...
#4 Updated by John Abbott 10 months ago
- Status changed from New to Resolved
- Assignee set to John Abbott
- % Done changed from 10 to 80
I have modified the code so that
TimeoutException is now derived from
ErrorInfo (rather than
InterruptException). This seems to make everything work as expected (based on just 1 test).
I'll check in shortly.