On Jan 23, 2014, at 1:47 PM, Timothy Baldridge <tbaldri...@gmail.com> wrote: > Sadly, put! on a closed channel has never thrown an exception (regardless of > what the docstring says).
LOL! OK, then I'm happy. > So to answer your question about closing with pending puts. > > 1) call put! on an open channel with no takes. > 2) put! returns true, since the put was enqueued. But since it was enqueued, > the callback has not been dispatched. > 3) close! the channel. Still no dispatch as close! does not discard data > 4) call take!. The take will succeed instantly (due to the pending put), and > the callback will be dispatched with true since the put succeeded. Excellent! That's exactly what I _hoped_ the new semantics were and it clarifies for me what happens when you close a channel that has data pending (enqueued). Sean Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ "Perfection is the enemy of the good." -- Gustave Flaubert, French realist novelist (1821-1880)
signature.asc
Description: Message signed with OpenPGP using GPGMail