[Seaside] Seaside Internals

Lukas Renggli renggli at student.unibe.ch
Sun Sep 7 10:56:53 CEST 2003


Hi Avi,

> No, what you're looking for is WAProcessMonitor>>critical:.
> Continuation>>terminate: is in fact what unwinds the stack, although it
> doesn't evaluate ensure blocks as it goes.  Whether or not it *should* 
> is
> an open question, and the source of some controversy in the Scheme 
> world -
> see, for example,
> http://www.nhplace.com/kent/PFAQ/unwind-protect-vs-continuations.html 
> or
> http://www.ccs.neu.edu/home/dorai/uwcallcc/uwcallcc.html .

those articles are very interesting, although I only know the very 
basics of Scheme. Hope the lecture about Scheme in the upcoming term, 
will improve my knowledge ...

> Can you give an example of some Seaside code with an #ensure: , and 
> when
> you think the #ensure: ought to be evaliated?

Sure! I discovered this problem when using a critical-section inside 
the code of a seaside callback with mutuallyExcludedBlock performing a 
very long lasting operation. As most of the users are impatient and 
click several times on the button/link I experienced cases where the 
application was completely blocked when other requests wanted to enter 
the section, as the critical-section has been never left (e.g. the 
ensure: has been never evaluated).

	Semaphore>>critical: mutuallyExcludedBlock
		self wait.
		[ blockValue _ mutuallyExcludedBlock value ]
			ensure: [ self signal ].
		^blockValue

What I basically tried to do then, is to add the following code to the 
beginning of the message Continuation>>terminate:

	context _ aContext.
	[ context sender notNil ]
		whileTrue: [ context _ context sender ].
	aContext unwindTo: context.

	...

and I started writing some manual tests checking that functionality, 
but did not succeed (probably because I did not know about this 
time-out).

Cheers
Lukas

-- 
Lukas Renggli
http://renggli.freezope.org



More information about the Seaside mailing list