[racket] Test for async-channel being full
On Fri, Nov 29, 2013 at 12:23:42PM -0800, Eric Dobson wrote:
> I'm trying to make a custom output port that is backed by a
> async-channel. One of the operations that ports need to provide is an
> event that is ready when progress on the event can be made. But since
> I cannot tell if the async-channel is full and put would not block
> without actually sending a value, I cannot provide such an event. Is
> it possible to provide such an API or does the implementation of
> async-channels prevent this?
I don't know much about creating custom ports, so I looked up progress
events in order to understand your question better. But now I'm
confused, because progress events seem to be specific to input ports,
whereas it sounds like you are creating an output port. What am I
missing?
Regarding your actual question: I think the reason a non-side-effecting
async-channel-put-evt is not provided is that using such an event could
lead to race conditions. A previous thread [1] on this list touched on
this with regard to places and channels as events; I'm extrapolating to
extend that answer to async-channel-put-evt.
David
[1] http://www.mail-archive.com/users@racket-lang.org/msg15630.html