X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Ftimer.lisp;h=53523859208eafbb2425e281a2f726072ddf4f99;hb=1b7d7105bac89ae7c5b5dae579965cd20f81c345;hp=3280bd2e260e38971d8ab95f2b7f02a5229742e7;hpb=64d420902d31cb87ea752f09b314e4767816a9c9;p=sbcl.git diff --git a/src/code/timer.lisp b/src/code/timer.lisp index 3280bd2..5352385 100644 --- a/src/code/timer.lisp +++ b/src/code/timer.lisp @@ -337,7 +337,9 @@ triggers." (handler-case (sb!thread:interrupt-thread thread function) (sb!thread:interrupt-thread-error (c) - (warn c))))))) + (declare (ignore c)) + (warn "Timer ~S failed to interrupt thread ~S." + timer thread))))))) ;; Called from the signal handler. (defun run-expired-timers () @@ -359,8 +361,26 @@ triggers." (defmacro sb!ext:with-timeout (expires &body body) #!+sb-doc - "Execute the body, asynchronously interrupting it and signalling a -TIMEOUT condition after at least EXPIRES seconds have passed." + "Execute the body, asynchronously interrupting it and signalling a TIMEOUT +condition after at least EXPIRES seconds have passed. + +Note that it is never safe to unwind from an asynchronous condition. Consider: + + (defun call-with-foo (function) + (let (foo) + (unwind-protect + (progn + (setf foo (get-foo)) + (funcall function foo)) + (when foo + (release-foo foo))))) + +If TIMEOUT occurs after GET-FOO has executed, but before the assignment, then +RELEASE-FOO will be missed. While individual sites like this can be made proof +against asynchronous unwinds, this doesn't solve the fundamental issue, as all +the frames potentially unwound through need to be proofed, which includes both +system and application code -- and in essence proofing everything will make +the system uninterruptible." (with-unique-names (timer) ;; FIXME: a temporary compatibility workaround for CLX, if unsafe ;; unwinds are handled revisit it.