[racket] Test for async-channel being full

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Tue Dec 3 08:44:32 EST 2013

Oh, right: so you probably don't want 'get' 'put' and 'is-full?' but you
want 'get' and 'try-put' that fails only when the channel is full,
returning a boolean to indicate success.


On Mon, Dec 2, 2013 at 11:24 PM, David T. Pierson <dtp at mindstory.com> wrote:

> 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
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20131203/cf666dcb/attachment-0001.html>

Posted on the users mailing list.