Hello,
I was just wondering if you are using the right function. Without
actually trying to run any code, a couple of things pop into mind:
1. alts! can only be used in a go macro.
2. The invocation doesn't look right for alts!.
Perhaps you want something like:
(let [[val port] (async/alts!! [[inner-chan e]]
:default :default
:priority true])
(condp = port
inner-chan (println "did the put")
default (println "failed to put")))
I hope this helps.
Sincerely,
Daniel
On Thu Aug 14 09:03 2014, dgrnbrg wrote:
> When I use alts!, it seems that both the put and :default action run every
> time. I've included the code sample below:
>
> (let [inner-chan (async/chan (async/buffer 1000))
> mult (async/mult inner-chan)
> (async/thread
> (while true
> (let [e (.take linked-blocking-queue)]
> (async/alts!
> [[inner-chan e]] (println "did the put")
> :default (println "failed to put")
> :priority true)))))
>
>
> Elsewhere in the code, I tap the mult before I start putting elements onto
> the linked-blocking-queue. For every element I put onto the LBQ, I see both
> messages: "did the put" and "failed to put". What is going on here?
>
> --
> 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.