[Pharo-project] [squeak-dev] Re: Process-specific state broken and uncomplete

Levente Uzonyi leves at elte.hu
Tue Nov 9 04:42:59 UTC 2010


On Tue, 9 Nov 2010, Igor Stasenko wrote:

snip

>
> No, you can't. I feel sorry for you :)
>
> A #useSession:during: using ensure, and of course it will work
> correctly, because you not accessing session via
> process-specific storage. This is illustrated by my "good fork" example.

Erm, no. In both of your examples the session wasn't aquired by the forked 
process. It was available via a variable. If you aquire the session _in_ 
the forked process _from_ the session store, then the #ensure: block in 
the session store will be able to retrieve it.

>
> now replace #doSomething with this:
>
> [ 1 year asDelay wait ] ensure: [
>  self assert:  (Processor activeProcess environmentAt: #session) notNil ]
>
> and then terminate a process which running your fork.

Replaced (in theory) and terminated. What will happen? This assertion in 
this #ensure: block will fail, but the session will be retrieved properly 
by the session store's unwind block.

So you can use process local variables, but you shouldn't access them 
during unwinding (#ensure:, #ifCurtailed:, whatever). This is possible as 
I showed it in my example.

>
> In attachment you'll find a test, which shows the problem (i using
> tests from Pharo image).

The test fails, because you're accessing a process local variable in an 
unwind block, which you shouldn't do.


Levente

>
>
>>
>> Levente
>>
>>
>> snip
>>
>>
>
>
>
> -- 
> Best regards,
> Igor Stasenko AKA sig.
>



More information about the Squeak-dev mailing list