>
> Querying the state of a channel at worst leads to race conditions and at
> best leads to bad design.
>

The open/closed state of a channel is simple to reason about (it only
changes, if ever, once), unlike the rest of state that is associated to a
given channel...

You're only supposed to close a channel from the producer side.
>

Why?

On Fri, Jul 12, 2013 at 9:22 PM, Brandon Bloom <brandon.d.bl...@gmail.com>wrote:

> > However, if what one is trying is to *stop* putting values on the
> channel, I see no possible race conditions.
>
> Querying the state of a channel at worst leads to race conditions and at
> best leads to bad design.
>
> You're only supposed to close a channel from the producer side. So if
> you're the only writer, then you know if you've closed the channel or not.
> If there are multiple writers, then need to be coordinated in some way.
> Typically, they would alt! against reading from a control channel and
> writing to the output channel. When you get a shutdown signal from the
> control channel, you stop writing.
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "Clojure" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/clojure/_KzEoq0XcHQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to