[Prev][Next][Index][Thread]
Re: threading - Waiting for multiple notifications
Just a note to point everybody at some possibly helpful ideas...
I have great success with implementations of John Reppy's channel ideas in
everything from Lisp to OCaml. John originally did his work in SML/NJ
producing a variant language known as CML (Concurrent ML).
While SML/NJ used continuation passing style for its code, and hence didn't
use any stack frames, that architecture readily enabled the use of
"speculative threading" as discussed in Reppy's book on Concurrent ML. This
particular aspect of Reppy channels is difficult to provide in stack based
languages, but everything else is readily doable.
One of the most interesting aspects of Reppy channels is the use of NAK
responses on rendezvous points to notify the requesting threads that their
attempted communication has failed. That allows explicit recovery actions to
proceed in the requesting client. Channels are higher order first class
objects that can be combined in very interesting ways to provide 1-of
notifications and parallel notifications, just to name a few.
For example, I can easily write code that waits until either A is signaled,
or else both B and C but not D is signaled. And I can specify timeout values
as well as NAK recovery code.
I have yet to provide these Reppy Channels to our Dylan work, but the
results from other implementations are showing us that this is definitely
worth doing.
I strongly recommend reading John Reppy's book (a translation of his
dissertation) "Concurrent Programming in ML", Cambridge U. Press, 1999.
Sources are available for his SML implementation, as well as our
translations to OCaml, NML, and Lisp.
- DM
"Chris Double" <chris@double.co.nz> wrote in message
wk7kujx23g.fsf@double.co.nz">news:wk7kujx23g.fsf@double.co.nz...
> Thanks for the reply, Scott. What you describe is similar to what I do
> with the exception that I had a separate notification for the
> WM_TIMECHANGED. I've now modified this to call a handler which does a
> schedule changed notification. This allows me to just work with the
> schedule notification and the timeout.
>
> I was using release-all as you describe - I followed much of the
> example in the <notification> description in the help. And looking at
> <event-queue> in DUIM!
>
> Thanks again,
> Chris.
> --
> http://www.double.co.nz/dylan
>
References: