作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
documentation for Control.Exception
描述哪些操作可以抛出异步异常,即使在 mask
内ed block,说:“以下操作保证不可中断”
takeMVar if the MVar is definitely full, and conversely putMVar if the MVar is definitely empty
MVar
从编译器的角度来看,“绝对”是满的还是空的?是否已经定义得足够好来推理我的代码是否会在不处理每个
MVar
上的异步异常的情况下中断?手术?
最佳答案
编译器没有做出这样的保证,这就是他们这么说的原因。
特别是如果MVar
已满,则 takeMVar
不会阻塞,并且不能被中断。同样对于空 MVar
和 putMVar
,因为它没有阻塞,所以不能被中断。
使用该措辞是因为如果 MVar
不是满的,说因为它有时是满的,有时不是,那么保证就不再是真的。
关于haskell - 什么时候可以保证 MVar 操作不间断?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20909425/
我是一名优秀的程序员,十分优秀!