WACurrentSession value is nil within a forked block

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

WACurrentSession value is nil within a forked block

Leandro Perez-2
Hello list,
I have a simple seaside SUComponent subclass called ForkComponent:

ForkComponent class>> canBeRoot
^true.

ForkComponent >> renderContentOn:html
(html button)
text: 'test fork';
onClick: (html evaluator callback:
[:script |
 self session. " the session is NOT NIL here"
[self session "The session IS NIL here!!"] fork
])

When the callback is processed, I can access the session by sending #session to self (the component). The problem I have is that the session is always nil within the forked block.

Is this behavior correct?
should the session be nil inside a forked block?
if so, why?

regards,
Leandro


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: WACurrentSession value is nil within a forked block

Lukas Renggli
> Is this behavior correct?

Yes, given the current implementation this behavior is totally correct.

> should the session be nil inside a forked block?

You can avoid your particular problem like this:

   session := self session.
   [ WACurrentSession use: session during: [ ... ] ] fork.

> if so, why?

WACurrentSession uses the exception handling (the execution stack) to
determine the current session. A forked block has a new stack and
looses this information. The package DynamicBindings provide some
tools to make similar things work across process boundaries,
unfortunately this is not really platform independent.

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: WACurrentSession value is nil within a forked block

Leandro Perez-2
> Is this behavior correct?

Yes, given the current implementation this behavior is totally correct.

> should the session be nil inside a forked block?

You can avoid your particular problem like this:

  session := self session.
  [ WACurrentSession use: session during: [ ... ] ] fork.

> if so, why?

WACurrentSession uses the exception handling (the execution stack) to
determine the current session. A forked block has a new stack and
looses this information. The package DynamicBindings provide some
tools to make similar things work across process boundaries,
unfortunately this is not really platform independent.

Cheers,
Lukas


 

Great Lukas thanks!
Leandro

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside