[plt-scheme] RE: Shared resources for servlets
Robby already mentioned "async-channel.ss", but I encourage anyone who
is interested to read the source.
Joe pointed out the need for `dynamic-wind' in case a writer aborts.
But in the web-server, the problem is even worse: the writer's session
might be killed off entirely, in which case it wouldn't release the
lock, and it wouldn't have a chance to release the lock even through
`dynamic-wind'.
The async-channel.ss implementation works correctly even if a writer or
reader is terminated. It relies on a combiantion of
* channels (the synchronous kind)
* multiplexed waiting (via `object-wait-multiple')
* custodian promotion via `thread-resume'
Matthew