Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/clojure/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asynchronous clojure.core.async/alts!!-保证只有一个通道工作?_Asynchronous_Clojure - Fatal编程技术网

Asynchronous clojure.core.async/alts!!-保证只有一个通道工作?

Asynchronous clojure.core.async/alts!!-保证只有一个通道工作?,asynchronous,clojure,Asynchronous,Clojure,当alts或高度时,是否保证只从或放入其中一个端口 (let [[value channel] (alts!! [c1 c2 c3 [1 c4]])] (cond (= channel c1) ; at this point, is it guaranteed that alts!! ; did not take from c2 and c3, and did not call (>!! c4 1)? (do-something

alts或<代码>高度时,是否保证只从或放入其中一个端口

(let [[value channel] (alts!! [c1 c2 c3 [1 c4]])]
   (cond (= channel c1)
         ; at this point, is it guaranteed that alts!!
         ; did not take from c2 and c3, and did not call (>!! c4 1)? 
         (do-something)))

我在文档中找不到与此相关的任何内容。我猜它是未定义的?

根据
alts
的函数“最多完成一个的多个通道操作。[…]”


这意味着调用函数时,端口上只会执行一次或零次(即,它将停止)操作。哪个操作是非确定性的,如docstring中所述:“除非
:priority
选项为true,否则如果有多个端口操作准备就绪,则将做出非确定性选择”。

是,这就是alts的要点!