Haskell:TVar:orElse [英] Haskell: TVar: orElse
本文介绍了Haskell:TVar:orElse的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是的其他"部分orElse
在由于另一个事务写入已读取的TVar
而重试某个事务时调用,或者仅在
Is the "else" part of orElse
called when a transaction is retried due to another transaction writing to a TVar
it had read, or only when retry
is explicitly called?
推荐答案
如果有
orElse a b
orElse a b
然后,只有在a
中显式调用retry
时,才会运行b
.否则,orElse
本质上将变得不确定. (由STM运行时完成的事务的重新运行是透明的,不应影响任何计算的结果.)
then b
is only run if retry
is called explicitly in a
. Otherwise orElse
would essentially become nondeterministic. (The rerunning of transactions that is done by the STM runtime is transparent and should not effect the outcome of any computation.)
这篇关于Haskell:TVar:orElse的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文