简体   繁体   English

Clojure异步放! 返回值

[英]Clojure async put! return value

Clojure async put! Clojure异步放! docs says (emphasis added) docs说(添加了重点)

Asynchronously puts a val into port, calling fn0 (if supplied) when complete. 异步将val放入端口,完成后调用fn0(如果提供)。 nil values are not allowed. 不允许使用零值。 Will throw if closed. 如果关闭将抛出。 If on-caller? 如果是来电者? (default true) is true, and the put is immediately accepted, will call fn0 on calling thread. (默认为true)为true,并且put被立即接受,将在调用线程上调用fn0。 Returns nil. 返回nil。

Yet the example code returns true 但是示例代码返回true

user=> (put! c "XYZ")
true

Are the docs incorrect or am I missing something? 文档不正确或我缺少什么吗?

This was fixed in this commit , the new doc string reads: 此commit中已解决此问题 ,新的文档字符串显示为:

"Asynchronously puts a val into port, calling fn1 (if supplied) when
complete, passing false iff port is already closed. nil values are
not allowed. If on-caller? (default true) is true, and the put is
immediately accepted, will call fn1 on calling thread.  Returns
true unless port is already closed."

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM