X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Ftimer.lisp;h=88b9c1da4315e5d1240b3381b44d897fead1ab88;hb=2c5a710f4da100f8aa9c7262fa76395f73ee4307;hp=381e363a5293479de60360df07ac7fa730dd5217;hpb=85e71404cf7ddc58fb85cb043155a4e9896e4d3e;p=sbcl.git diff --git a/src/code/timer.lisp b/src/code/timer.lisp index 381e363..88b9c1d 100644 --- a/src/code/timer.lisp +++ b/src/code/timer.lisp @@ -156,14 +156,15 @@ future versions." (defun make-timer (function &key name (thread sb!thread:*current-thread*)) #!+sb-doc - "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 -allowed." + "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 @@ triggers." (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. (when old-position (funcall (%timer-cancel-function timer))) (when (eql 0 old-position)