X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Ftimer.lisp;h=b84168a1147ec33d5d60ae26ee9310999a0aabcd;hb=f8c8f81c3e10865a40ea6ceb79be0a045a6e6e4e;hp=5a1f4faea8efefc72d1cd24b5ee8fe2ef44c1650;hpb=decddddf7e581fa1ebee846e5fddcd52229bb9a8;p=sbcl.git diff --git a/src/code/timer.lisp b/src/code/timer.lisp index 5a1f4fa..b84168a 100644 --- a/src/code/timer.lisp +++ b/src/code/timer.lisp @@ -368,6 +368,9 @@ triggers." (set-system-timer)) (run-timer timer))) +(defun timeout-cerror () + (cerror "Continue" 'sb!ext::timeout)) + (defmacro sb!ext:with-timeout (expires &body body) #!+sb-doc "Execute the body, asynchronously interrupting it and signalling a TIMEOUT @@ -390,14 +393,13 @@ 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. - `(if (> ,expires 0) - (let ((,timer (make-timer (lambda () - (cerror "Continue" 'sb!ext::timeout))))) - (schedule-timer ,timer ,expires) - (unwind-protect - (progn ,@body) - (unschedule-timer ,timer))) - (progn ,@body)))) + `(dx-flet ((timeout-body () ,@body)) + (let ((expires ,expires)) + ;; FIXME: a temporary compatibility workaround for CLX, if unsafe + ;; unwinds are handled revisit it. + (if (> expires 0) + (let ((timer (make-timer #'timeout-cerror))) + (schedule-timer timer expires) + (unwind-protect (timeout-body) + (unschedule-timer timer))) + (timeout-body)))))