Andreas Raab uploaded a new version of Kernel to project The Trunk: http://source.squeak.org/trunk/Kernel-ar.718.mcz
==================== Summary ====================
Name: Kernel-ar.718 Author: ar Time: 4 December 2012, 8:40:21.883 pm UUID: 34faba8b-abd8-a749-b293-9e843f1b1eeb Ancestors: Kernel-cmm.717
Fix broken behavior in nested valueWithin:onTimeout: usage.
=============== Diff against Kernel-cmm.717 ===============
Item was changed: ----- Method: BlockClosure>>valueWithin:onTimeout: (in category 'evaluating') ----- valueWithin: aDuration onTimeout: timeoutBlock "Evaluate the receiver. If the evaluation does not complete in less than aDuration evaluate the timeoutBlock instead"
+ | theProcess delay watchdog tag | - | theProcess delay watchdog |
aDuration <= Duration zero ifTrue: [^ timeoutBlock value ].
"the block will be executed in the current process" theProcess := Processor activeProcess. delay := aDuration asDelay. + tag := self.
"make a watchdog process" watchdog := [ delay wait. "wait for timeout or completion" + theProcess ifNotNil:[ theProcess signalException: (TimedOut new tag: tag)] - theProcess ifNotNil:[ theProcess signalException: TimedOut ] ] newProcess.
"Watchdog needs to run at high priority to do its job (but not at timing priority)" watchdog priority: Processor timingPriority-1.
"catch the timeout signal" ^ [ watchdog resume. "start up the watchdog" self ensure:[ "evaluate the receiver" theProcess := nil. "it has completed, so ..." delay delaySemaphore signal. "arrange for the watchdog to exit" + ]] on: TimedOut do: [ :e | + e tag == tag + ifTrue:[ timeoutBlock value ] + ifFalse:[ e pass]].! - ]] on: TimedOut do: [ :e | timeoutBlock value ]. - !
Item was changed: ----- Method: BlockContext>>valueWithin:onTimeout: (in category 'evaluating') ----- valueWithin: aDuration onTimeout: timeoutBlock "Evaluate the receiver. If the evaluation does not complete in less than aDuration evaluate the timeoutBlock instead"
+ | theProcess delay watchdog tag | - | theProcess delay watchdog |
aDuration <= Duration zero ifTrue: [^ timeoutBlock value ].
"the block will be executed in the current process" theProcess := Processor activeProcess. delay := aDuration asDelay. + tag := self.
"make a watchdog process" watchdog := [ delay wait. "wait for timeout or completion" + theProcess ifNotNil:[ theProcess signalException: (TimedOut new tag: tag)] - theProcess ifNotNil:[ theProcess signalException: TimedOut ] ] newProcess.
"Watchdog needs to run at high priority to do its job (but not at timing priority)" watchdog priority: Processor timingPriority-1.
"catch the timeout signal" ^ [ watchdog resume. "start up the watchdog" self ensure:[ "evaluate the receiver" theProcess := nil. "it has completed, so ..." delay delaySemaphore signal. "arrange for the watchdog to exit" + ]] on: TimedOut do: [ :e | + e tag == tag + ifTrue:[ timeoutBlock value ] + ifFalse:[ e pass]].! - ]] on: TimedOut do: [ :e | timeoutBlock value ]. - !
squeak-dev@lists.squeakfoundation.org