18.104.22.168: minor MAKE-TIMER cleanups
Patch by Brit Butler, lp#672252.
* Improve the docstring for SB-EXT:MAKE-TIMER.
* Add a minor comment to unschedule-timer.
...with minor edits by yours truly, including dropping
the bogus SCHEDULE-TIMER change from the original patch.
RCS file: /cvsroot/sbcl/sbcl/version.lisp-expr,v
retrieving revision 1.5171
diff -u -r1.5171 version.lisp-expr
--- version.lisp-expr 12 Feb 2011 15:22:25 -0000 1.5171
+++ version.lisp-expr 12 Feb 2011 15:25:53 -0000
@@ -20,4 +20,4 @@
;;; checkins which aren't released. (And occasionally for internal
;;; versions, especially for internal versions off the main CVS
;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
RCS file: /cvsroot/sbcl/sbcl/src/code/timer.lisp,v
retrieving revision 1.19
diff -u -r1.19 timer.lisp
--- src/code/timer.lisp 30 Sep 2010 08:39:39 -0000 1.19
+++ src/code/timer.lisp 12 Feb 2011 15:25:53 -0000
@@ -156,14 +156,15 @@
(defun make-timer (function &key name (thread sb!thread:*current-thread*))
- "Create a timer object that's when scheduled runs FUNCTION. If
-THREAD is a thread then that thread is to be interrupted with
-FUNCTION. If THREAD is T then a new thread is created each timer
-FUNCTION is run. If THREAD is NIL then FUNCTION can be run in any
-thread. When THREAD is not T, INTERRUPT-THREAD is used to run FUNCTION
-and the ordering guarantees of INTERRUPT-THREAD also apply here.
-FUNCTION always runs with interrupts disabled but WITH-INTERRUPTS is
+ "Create a timer that runs FUNCTION when triggered.
+If a THREAD is supplied, FUNCTION is run in that thread. If THREAD is
+T, a new thread is created for FUNCTION each time the timer is
+triggered. If THREAD is NIL, FUNCTION is run in an unspecified thread.
+When THREAD is not T, INTERRUPT-THREAD is used to run FUNCTION and the
+ordering guarantees of INTERRUPT-THREAD apply. FUNCTION runs with
+interrupts disabled but WITH-INTERRUPTS is allowed."
(%make-timer :name name :function function :thread thread))
(defun timer-name (timer)
@@ -285,6 +286,8 @@
(setf (%timer-expire-time timer) nil
(%timer-repeat-interval timer) nil)
(let ((old-position (priority-queue-remove *schedule* timer)))
+ ;; Don't use cancel-function as the %timer-cancel-function
+ ;; may have changed before we got the scheduler lock.
(funcall (%timer-cancel-function timer)))
(when (eql 0 old-position)