[Seaside] Re: Render loop... not looping

Esteban A. Maringolo eMaringolo at smalltalking.net
Thu Nov 10 13:55:54 CET 2005


I've found something, I paste the text posted to the c.l.s.dolphin 
newsgroup below.

Julian Fitzell escribió:
> Esteban A. Maringolo wrote:
>> 2005/11/8, Julian Fitzell <julian at beta4.com>:
>>> Esteban A. Maringolo wrote:
>>>> Julian Fitzell escribió:
>>>> And what is the purpose of the critical:ifError: method?
>>>> Why it uses a mutex and forks the evaluation of the block?
>>> It's designed to ensure that only one request is evaluating within a
>>> session at a time.  This is desirable because otherwise everything would
>>> need to be written to support concurrency.  In fact, given that we are
>>> reverting object instvars back and forth to handle continuations this is
>>> pretty important even at the system level.  As it stands, that semaphore
>>> ensures you only need to worry about concurrent access of resources that
>>> are accessed by more than one session (db, etc).
>> Thanks. I've imagined it to be that. What I didn't see is the side
>> effect of not having to deal with concurrency everywhere.
>> By now I'm using it without mutex nor semaphore until I find a
>> solution to make it work on Dolphin.
>> Any clues about why it doesn't render again?
> Erm, not totally obvious to me...  though it sounds like it could be a 
> problem with the state being rolled back and since that is probably 
> affected by the semaphore, perhaps there is some interaction going on 
> there.  

I've found that the ensured block was executed twice, it is the 
semaphore signaled twice too. Removing the ensuring everything works 
ok. What is the relation of this to continuations... I can't tell, 
but my guess is that has something with ProcessCopier.

So... replacing:

WAProcessMonitor>>critical: aBlock ifError: errorBlock
| value |
value := nil.
mutex critical: [ "mutex is a mutually exclusive semaphore"
   responseSem := Semaphore new.
   process := [
     [value := aBlock on: Error do: errorBlock]
     ensure: [responseSem signal]
   ] fork.
   responseSem wait.
process := nil.


WAProcessMonitor>>critical: aBlock ifError: errorBlock
| value |
value := nil.
mutex critical: [
   responseSem := Semaphore new.
   process := [
     value := aBlock on: Error do: errorBlock.
     responseSem signal
     ] fork.
   responseSem wait.
process := nil.

Everything starts working magically. Of course, no ensuring is done, 
but by now it wasn't necessary, in the future this has to be solved.

 > I'd look into it more for you but I'm trying to get ready to go
> to india tomorrow morning so I'm a bit swamped.  

Happy traveling.

 > I'm sure someone else
> can give you another pointer...

A breeze sound by now :-/

Best regards,


More information about the Seaside mailing list