[plt-scheme] Cleanup on Servlet Timeout (Again)

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun Aug 24 07:11:24 EDT 2008

At Sun, 24 Aug 2008 01:46:07 -0400, "Henk Boom" wrote:
> 2008/8/21 Matthew Flatt <mflatt at cs.utah.edu>:
> > The process representing the resource accepts reader requests and lets
> > them run them in parallel; when a reader asks to become a writer, then
> > the managing process waits for all the other readers to finish before
> > granting the conversion; if there's already a pending writer, then all
> > new writer-conversion requests are rejected. The process can see when a
> > reader/writer terminates, and it can adjust accordingly. The enclosed
> > "rwlock.ss" illustrates this implementation.
> 
> I have a couple of questions: (so far =)
> 
> 1) What is the purpose of 'reply'? The clients seem to read back from
> their accept channels right away, so what is to be lost by blocking on
> the calls to channel-put?

The client might be delayed indefinitely, either due to scheduling or
being explicitly suspended by some third party. You don't want to block
the server (and all other threads that might talk to the server) while
one client is delayed.

> 2) Looking at the documentation, 'remove' doesn't specify which
> argument to the 'equals?' function comes from the list, your use in
> removing a reader from the reader list assumes it is the second
> argument. Is this correct? (I find filter clearer here in any case,
> even if it does go through the whole list)

Yes. I meant to fix the `remove' docs to clarify the order, but
`filter' seems like a good solution.


Matthew



Posted on the users mailing list.