MacroPackage: mpToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version

with-virtual-timeout

Arguments: (mode seconds &body timeout-body) &body body

This macro is simlar to sys:with-timeout with the addition of a mode argument. mode must be :process or :thread. The :thread option is only valid in SMP lisps.

When mode is :process, the timeout occurs after the specified time (in seconds as for sys:with-timeout) has been used by the cpu when running the Lisp process, not counting time spent doing garbage collection.

When mode is :thread (which is allowed in SMP Lisps only), the timeout occurs after the specified time (in seconds as for sys:with-timeout) has been used by the cpu when running thread executing the body code, not counting time spent doing garbage collection.

Contrast this behavior with sys:with-timeout, which times out after time real time seconds. See sys:with-timeout for more information on the other arguments.

Here is an example of code using with-virtual-timeout. We define a variant of y-or-n-p which times out after a specified number of seconds, taking the default value specified in the arguments.

(defun y-or-n-p-with-virtual-timeout (seconds default &rest args)
  (mp:with-virtual-timeout (:process seconds (format t "[Timed out] ~a~%" default)
	     default)
	 (apply #'y-or-n-p args)))

See multiprocessing.htm for general information on multiprocessing in Allegro CL.


Copyright (c) 1998-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version