![]() | ![]() | ![]() | with-timeout | ![]() |
| ( seconds timeout-form*) | [Macro] |
Purpose
Bound the time allowed to evaluate
Package :portable-threads
Module :portable-threads
Arguments and values
seconds | A number | |
timeout-forms | An implicit | |
forms | An implicit | |
results | The values returned by evaluating the last form or the
last |
Returns
The values returned by evaluating the last form if
completed in less than
Errors
Threads (multiprocessing) is not supported on the
Common Lisp implementation. However,
Description
If the evaluation of
See also
condition-variable-wait-with-timeout
Examples
Evaluate a simple form, with a one-second time out:
> (with-timeout (1 ':timed-out) ':did-not-time-out) :did-not-time-out >Again, but this time sleep for two seconds to cause a time out:
> (with-timeout (1 ':timed-out)
(sleep 2)
':did-not-time-out)
:timed-out ; (after 1 second)
>
Uses of > (with-timeout (1 ':timed-out-outer) (with-timeout (2 ':timed-out-inner) (sleep 3) ':did-not-time-out)) :timed-out-outer ; (after 1 second) > (with-timeout (2 ':timed-out-outer) (with-timeout (1 ':timed-out-inner) (sleep 3) ':did-not-time-out)) :timed-out-inner ; (after 1 second) >
The GBBopen Project
![]() | ![]() | ![]() | with-timeout | ![]() |