The best way to understand how/why this happens is to look at the source of
>!!. In short, the thread making the call doesn't block on the channel. It
starts an async put, then waits on a promise that is delivered by the async
put. So it works something like this:

1) Calling thread creates a promise
2) Calling thread calls put! telling it to deliver the promise once the put
completes
3) Calling thread tries an immediate put! but fails since the channel is
blocked. So the put is enqueued into the channel.
4) Calling thread is canceled (maybe? not sure how this works in nrepl or
whatever is being used here)
5) put! completes, so a different thread executes the callback and delivers
the promise
6) If the thread hasn't been completely killed yet it's possible that it
may get the value from the delivered promise and continue

In short, core.async doesn't support any sort of cancellation without use
of alt!



On Wed, Jun 27, 2018 at 11:18 AM, Justin Smith <[email protected]> wrote:

> I should be more precise there, by "consumed" I meant buffered or consumed.
>
> On Wed, Jun 27, 2018 at 10:17 AM Justin Smith <[email protected]>
> wrote:
>
>> I doubt core.async would ever make promises about the behavior of a
>> blocking put that gets forcibly cancelled. It promises that the blocking
>> put doesn't return until the message is consumed, but that's not the same
>> as promising that the message isn't consumed if the blocking put is
>> forcibly cancelled.
>>
>> On Wed, Jun 27, 2018 at 9:47 AM Didier <[email protected]> wrote:
>>
>>> I think its due to ctrl+c, not sure what it actually does, but maybe it
>>> didn't actually kill the blocked thread?
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to [email protected]
>>> Note that posts from new members are moderated - please be patient with
>>> your first post.
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> 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 [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected]
> 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 [email protected].
> For more options, visit https://groups.google.com/d/optout.
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to