Re: >! on channels that are not yet closed

2014-01-14 Thread t x
@Timothy: Looking forward to your changes. Thanks for all the existing work with core.async! (I was half tempted to switch to Scala to use Akka right before core.async came out.) On Tue, Jan 14, 2014 at 10:30 AM, t x wrote: > @Ghadi, > > > Are you referring to the race condition between: > > (

Re: >! on channels that are not yet closed

2014-01-14 Thread t x
@Ghadi, Are you referring to the race condition between: (check if channel is closed) ### BAM SOMETHING HAPPENS (put something on to the channel) ? I agree it's a race condition, however after some refactoring, I no longer care if I'm >!-ing onto a closed channel, as long as I eventually know

Re: >! on channels that are not yet closed

2014-01-14 Thread Timothy Baldridge
It's a known problem (putting into a closed channel), and one we have a possible solution for (it's in one of the branches of core.async). I'll bring it up this Friday and see if we can't make some progress on the code. Timothy On Tue, Jan 14, 2014 at 10:43 AM, Ghadi Shayban wrote: > This code

Re: >! on channels that are not yet closed

2014-01-14 Thread Ghadi Shayban
This code actually results in a subtle race condition as channels need to be locked internally. It also won't work for other implementations of channel, of which there are several in core.async besides ManytoManyChannel. (For example, map< returns a reified channel.) Knowing whether a channel

Re: >! on channels that are not yet closed

2014-01-13 Thread t x
(let [c (async/chan 10)] (println @(.-closed c)) (async/close! c) (println @(.-closed c))) And we're done. Sorry for the spam. Last message send in case someone finds my question via Google. On Mon, Jan 13, 2014 at 2:11 AM, t x wrote: > Is there anyway, to "pierce the deftype" > > > htt

Re: >! on channels that are not yet closed

2014-01-13 Thread t x
Is there anyway, to "pierce the deftype" https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async/impl/channels.clj#L31 to read the "closed" field of the ManytoMany Channel? That's basically all I need to do. On Mon, Jan 13, 2014 at 1:47 AM, t x wrote: > Hi, > >