||(Linux only) Quits execution of a procedure after a timeout passed
||Timeout(seconds : INTEGER) : INTEGER
||seconds : Number of seconds until execution abort or 0 to cancel a previously set timeout
This function calls the linux function Alarm and passes the given parameter to it.
The linux kernel then sends a SIGALRM signal to the process calling after a given number of seconds have passed.
Tdbengine processes this signal by immediately leaving the currently processed procedure by executing RETURN 0 (or RETURN "" for STRING functions).
In case that, before the signal was sent, the function Timeout() has been called with the parameter 0, no signal will be send at all.
This allows a easy but effective way to code timeouts.
Example 1: Timeout + ReadLn from console
The user has 10 seconds to enter his account ID.
PROCEDURE Input : INTEGER
VAR id : STRING
writeln(0,'Your account id: ')
IF Input THEN
writeln(0,'Your input will be processed now...')
writeln(0,'Cancel forced by timeout')
Write a comment: