diff options
| author | Richard M. Stallman | 2006-09-04 15:07:32 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2006-09-04 15:07:32 +0000 |
| commit | 0a369706ff1743a115dd39648df6487ebe2f5025 (patch) | |
| tree | 7cd3b9a36bd083311e3ca82ebaf974dfdbd799e2 | |
| parent | f39d6be01d06026a64e08009b773dc6b7c9d7a2b (diff) | |
| download | emacs-0a369706ff1743a115dd39648df6487ebe2f5025.tar.gz emacs-0a369706ff1743a115dd39648df6487ebe2f5025.zip | |
(Idle Timers): Explain why timer functions should not
loop until (input-pending-p).
| -rw-r--r-- | lispref/os.texi | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lispref/os.texi b/lispref/os.texi index f6682548e5b..edf5833bf42 100644 --- a/lispref/os.texi +++ b/lispref/os.texi | |||
| @@ -1578,6 +1578,25 @@ Here's an example: | |||
| 1578 | @end smallexample | 1578 | @end smallexample |
| 1579 | @end defun | 1579 | @end defun |
| 1580 | 1580 | ||
| 1581 | Some idle timer functions in user Lisp packages have a loop that | ||
| 1582 | does a certain amount of processing each time around, and exits when | ||
| 1583 | @code{(input-pending-p)} is non-@code{nil}. That approach seems very | ||
| 1584 | natural but has two problems: | ||
| 1585 | |||
| 1586 | @itemize | ||
| 1587 | @item | ||
| 1588 | It blocks out all process output (since Emacs accepts process output | ||
| 1589 | only while waiting). | ||
| 1590 | |||
| 1591 | @item | ||
| 1592 | It blocks out any idle timers that ought to run during that time. | ||
| 1593 | @end itemize | ||
| 1594 | |||
| 1595 | @noindent | ||
| 1596 | To avoid these problems, don't use that technique. Instead, write | ||
| 1597 | such idle timers to reschedule themselves after a brief pause, using | ||
| 1598 | the method in the @code{timer-function} example above. | ||
| 1599 | |||
| 1581 | @node Terminal Input | 1600 | @node Terminal Input |
| 1582 | @section Terminal Input | 1601 | @section Terminal Input |
| 1583 | @cindex terminal input | 1602 | @cindex terminal input |