On 4/22/2015 8:12 PM, David Vanderson wrote:
On 04/20/2015 05:54 AM, George Neuner wrote:

I know I need a different response function. The question was whether embed/url is tied to HTML or can be used in a different context. The documentation (6.1.1) says:

"When used inside page <mailbox:///C:/Users/GW/Documents/Eudora/local/Mail/Local%20Folders/Drafts?number=0&part=1.2.2&filename=page.html> syntactically, a rename transformer for the procedure embedding function; otherwise, a syntax error."

That suggests embed/url can be used only in (X)HTML responses and that I need to use something else to create dispatch URLs in regular code.

I think I see why that's confusing. The syntax parameter "embed/url", is not being used in the code I sent. In that code, "embed/url" is the name of a regular parameter to the lambda function being supplied to send/suspend/dispatch. I probably should have used a different parameter name. Does that make sense?

Ok. I guess then an example would be helpful: how to generate 2 continuation URLs in Scheme code and stick them into a hash.

My code now looks like:

    create a hash representing the return object
        - data to return
    convert the hash to a jsexpr
    send/back the jsexpr

What I want to do is:

    create a hash representing the return object
        - data to return
        - URL for next page function (if applicable)
        - URL for prev page function (if applicable)
    convert the hash to a jsexpr
    send/suspend/dispatch  the jsexpr


My understanding is that when you do send/suspend*, the continuation is saved, and the thread finishes. The continuation and thread are not bound together. So when a request comes in to continue that continuation, it will be a different (new?) thread that runs it.

That's fine: the "term" thread is overloaded. I understand that Racket threads are user-land scheduler activations [I think that's the term] ... i.e. just multiplexed continuations. My point was that there is some execution context hanging around when the "thread" is suspended and it wasn't clear that it would be GC'd if/when all the thread's send/suspend "continuations" expire.

There's nothing that says definitively that the servlet continuation manager is holding the *only* references to the thread context [or the only strong references if that's more applicable] - somewhere I recall Jay explaining the structure being something like:
server->custodian->custodian(s)->thread(s)->user-stuff ???
and it is not clear where the continuation manager lives in the hierarchy [ though I can guess ].


Can you give an example of the processing that you want to know has been finished? Do you want the thread serving the request to do some processing after sending the response?

The thread can be suspended after sending a response. What I'd like, though, is for it to wake up again and log some exit data when all continuations expire.

That could - with difficulty - be done from an exception handler if the thread is terminated by exception as opposed to simply evaporating, and also provided that I know what exception(s) to catch or events to wait on. One of the issues I've had with real-world Racket programming is determining what exactly happens when things go wrong. A catch-all exn or exn:fail handler doesn't cut it when you need more detail, and, of course, the hierarchy is extensible so things may be thrown that aren't documented. "read the code" is fine for research, but it isn't a realistic real-world answer - there's too much code and not enough time. As I said to Jay recently, I wouldn't know where to look even if I had the source.


Thanks,
Dave

Thank you,
George

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to