[plt-scheme] spawning threads in web server

From: Robby Findler (robby at cs.uchicago.edu)
Date: Mon Mar 1 15:10:57 EST 2004

When you create a thread, you're starting with an empty continuation,
anyways. Would it be enough to register something in a table somewhere
and send a url that starts a new servlet (that will then look into the
table)?

That way, for those special urls, you can also have your own
timeout-ing.

Robby

At Mon, 01 Mar 2004 15:05:23 -0500, David Van Horn wrote:
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 
> It's easy enough to have a servlet that pauses computation, sends a URL to an 
> email address and then resumes once the URL is visited.  I have a slightly 
> different situation.  I'd like to have the computation continue for the user, 
> but email a URL that will continue down another path of computation when visited.
> 
> I use this to notify the administrator about certain user actions that require 
> attention.  The administrator is sent a URL that when visited will have forms 
> tailored for the specific user and required action.
> 
> I had thought something like this would work:
> 
>    (send/suspend/dispatch
>     `(html
>       (form ((action
>               ,(lambda (request)
>                  ...
>                  (thread
>                   (lambda ()
>                     ((lambda (request) ...)
>                      (send/suspend
>                       (lambda (k-url)
>                         (send-email admin k-url)
>                         `(html
>                           (form ;; for admin use.
>                            ...)))))))
>                  (send/finish
>                   '(html (p "thanks for notifying the admins."))))))
> 
>             ... ;; for user use.
>             )))
> 
> But this gives the following error:
> 
> Servlet exception: "continuation application: attempted to apply foreign 
> continuation (created in another thread)"
> 
> I don't see how to do this without spawning a new thread; perhaps I'm 
> overlooking something obvious.  Any help would be appreciated.
> 
> Thanks,
> David
> 



Posted on the users mailing list.