MacroPackage: mpToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
This page is new in 10.1.

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-2017, Franz Inc. Oakland, CA., USA. All rights reserved.
This page is new in the 10.1 release.
Created 2017.2.15.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
This page is new in 10.1.