running code asynchronously

View: New views
3 Messages — Rating Filter:   Alert me  

running code asynchronously

by rjk-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear Seasiders,

I'm cooking up some seaside/code recipes as an exercise and hopefully
for (web)publication some day, i have the following question;

Q. How do i run code asynchronously (inside the request/response  
cycle) ?
A. My answer at this point is the following using a [block] fork.  
construct
as described in Smalltalk by example from alex sharp:

        01 renderContentOn: html
        02    html paragraph: Time now asTimeStamp.
        03    [Transcript cr; show: 'waiting for 10 seconds...'.
        04    (Delay forSeconds: 10) wait.
        05    Transcript cr; show: 'done!...'] fork.
        06    html paragraph: Time now asTimeStamp.

Could somebody confirm this? and give additional comments if this is  
not the true seaside way?
Thanks in advance!

Redmar Kerkhoff
_______________________________________________
seaside mailing list
seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

Re: running code asynchronously

by Stefan Schmiedl :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, 27 Apr 2008 22:17:45 +0200
rjk <rjkerkhoff@...> wrote:

> Dear Seasiders,
>
> I'm cooking up some seaside/code recipes as an exercise and hopefully
> for (web)publication some day, i have the following question;
>
> Q. How do i run code asynchronously (inside the request/response  
> cycle) ?

The question sounds wrong :-D

IMO, it's either "synchronously inside the cycle" or "asynchronously
beside the cycle".

> A. My answer at this point is the following using a [block] fork.  
> construct
> as described in Smalltalk by example from alex sharp:
>
> 01 renderContentOn: html
> 02    html paragraph: Time now asTimeStamp.
> 03    [Transcript cr; show: 'waiting for 10 seconds...'.
> 04    (Delay forSeconds: 10) wait.
> 05    Transcript cr; show: 'done!...'] fork.
> 06    html paragraph: Time now asTimeStamp.
>
> Could somebody confirm this? and give additional comments if this is  
> not the true seaside way?

re "true seaside way": That would totally depend on what you're doing
in the forked thread.

s.
_______________________________________________
seaside mailing list
seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

Re: running code asynchronously

by Philippe Marschall :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2008/4/27 rjk <rjkerkhoff@...>:

> Dear Seasiders,
>
>  I'm cooking up some seaside/code recipes as an exercise and hopefully
>  for (web)publication some day, i have the following question;
>
>  Q. How do i run code asynchronously (inside the request/response cycle) ?
>  A. My answer at this point is the following using a [block] fork. construct
>  as described in Smalltalk by example from alex sharp:
>
>         01 renderContentOn: html
>         02    html paragraph: Time now asTimeStamp.
>         03    [Transcript cr; show: 'waiting for 10 seconds...'.
>         04    (Delay forSeconds: 10) wait.
>         05    Transcript cr; show: 'done!...'] fork.
>         06    html paragraph: Time now asTimeStamp.
>
>  Could somebody confirm this? and give additional comments if this is not
> the true seaside way?

- What problem do you want to solve?
- Whatever you do are you sure you want to do it in the rendering phase?

Cheers
Philippe
_______________________________________________
seaside mailing list
seaside@...
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside