Mon, 3 May 2004 16:26:10 -0500
One thing I never understood about CML: why is it that a single object
represents a bi-directional channel instead of having a separate read and
write channel. The advantage of the latter is that it makes it much easier
(and obvious) for the GC to eliminate threads that can have no effect. As an
example, if the write end of a channel is lost (GC'd) then any thread
blocking on a read from the channel is garbage. Because of the synchronous
aspect of channels, the same is true of the reverse situation.
There are clearly times when you need a bi-directional connection, but that
can trivially be done by creating two channels and packaging the write end of
one and the read end of the other one.
I assume that unless you are lucky, with the CML method, I will get threads
blocked for ever and never collected quite frequently, right?
One other question: with the current implementation, just how fast is
something like ping-pong (I.e., two threads just sending unit messages to
each other as fast as they can until some count is reached)?