comparison lispref/os.texi @ 73037:ce175d3f53fd

(Timers): Clarify about REPEAT when timer is delayed.
author Richard M. Stallman <rms@gnu.org>
date Thu, 21 Sep 2006 01:51:55 +0000
parents ade5681a8e7e
children 43aadb7f2e64
comparison
equal deleted inserted replaced
73036:384cb0bcd86b 73037:ce175d3f53fd
1405 it should save and restore the match data. @xref{Saving Match Data}. 1405 it should save and restore the match data. @xref{Saving Match Data}.
1406 1406
1407 @deffn Command run-at-time time repeat function &rest args 1407 @deffn Command run-at-time time repeat function &rest args
1408 This sets up a timer that calls the function @var{function} with 1408 This sets up a timer that calls the function @var{function} with
1409 arguments @var{args} at time @var{time}. If @var{repeat} is a number 1409 arguments @var{args} at time @var{time}. If @var{repeat} is a number
1410 (integer or floating point), the timer also runs every @var{repeat} 1410 (integer or floating point), the timer is scheduled to run again every
1411 seconds after that. If @var{repeat} is @code{nil}, the timer runs 1411 @var{repeat} seconds after @var{time}. If @var{repeat} is @code{nil},
1412 only once. 1412 the timer runs only once.
1413 1413
1414 @var{time} may specify an absolute or a relative time. 1414 @var{time} may specify an absolute or a relative time.
1415 1415
1416 Absolute times may be specified in a wide variety of formats; this 1416 Absolute times may be specified in a wide variety of formats; this
1417 function tries to accept all the commonly used date formats. The most 1417 function tries to accept all the commonly used date formats. The most
1455 1455
1456 The function @code{run-at-time} returns a timer value that identifies 1456 The function @code{run-at-time} returns a timer value that identifies
1457 the particular scheduled future action. You can use this value to call 1457 the particular scheduled future action. You can use this value to call
1458 @code{cancel-timer} (see below). 1458 @code{cancel-timer} (see below).
1459 @end deffn 1459 @end deffn
1460
1461 A repeating timer nominally ought to run every @var{repeat} seconds,
1462 but remember that any invocation of a timer can be late. Lateness of
1463 one repetition has no effect on the scheduled time of the next
1464 repetition. For instance, if Emacs is busy computing for long enough
1465 to cover three scheduled repetitions of the timer, and then starts to
1466 wait, it will immediately call the timer function three times in
1467 immediate succession (presuming no other timers trigger before or
1468 between them). If you want a timer to run again no less than @var{n}
1469 seconds after the last invocation, don't use the @var{repeat} argument.
1470 Instead, the timer function should explicitly reschedule the timer.
1460 1471
1461 @defmac with-timeout (seconds timeout-forms@dots{}) body@dots{} 1472 @defmac with-timeout (seconds timeout-forms@dots{}) body@dots{}
1462 Execute @var{body}, but give up after @var{seconds} seconds. If 1473 Execute @var{body}, but give up after @var{seconds} seconds. If
1463 @var{body} finishes before the time is up, @code{with-timeout} returns 1474 @var{body} finishes before the time is up, @code{with-timeout} returns
1464 the value of the last form in @var{body}. If, however, the execution of 1475 the value of the last form in @var{body}. If, however, the execution of