[squeak-dev] WeakArray finalization never yields

marcel.taeumel Marcel.Taeumel at hpi.de
Mon Apr 11 12:42:16 UTC 2016


Hi, there!

Please, have a look at WorldState >> #runStepMethodsIn:, which processes the
list of deferred UI messages in a loop:

runStepMethodsIn: aWorld
	"Perform periodic activity inbetween event cycles"
	| queue msg limit stamp |
	"Limit processing of deferredUIMessages to a max. amount of time"
	limit := self class deferredExecutionTimeLimit.
	stamp := Time millisecondClockValue.
	queue := self class deferredUIMessages.
	[(Time millisecondsSince: stamp) >= limit 
		or:[(msg := queue nextOrNil) == nil]] 
			whileFalse: [msg value].
	"..."

There is a time limit to keep the UI responsive.

Now look at WeakArray class >> finalizationProcess:

finalizationProcess

	[FinalizationSemaphore wait.
	 FinalizationLock
		critical:
			[FinalizationDependents do:
				[ :weakDependent |
				weakDependent ifNotNil:
					[weakDependent finalizeValues]]]
		ifError:
			[:msg :rcvr | rcvr error: msg]] repeat

Could be add a "Process yield" in the loop to keep the system responsive
when facing complex finalization routines? Or would that just post-pone the
problem? We could add support for having many-many small finalizers, which
add up to a big amount of time to finalize. Like Morphic's deferred UI
message handling does.

What about priorities? At the moment, we have to ways to specify the
priority at which priority Object >> #finalize is called.

Has this finalization mechanism been used extensively in some project?

Best,
Marcel



--
View this message in context: http://forum.world.st/WeakArray-finalization-never-yields-tp4889361.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.


More information about the Squeak-dev mailing list