ML Refs 的访问保证?

发布于 2024-09-26 18:27:37 字数 28 浏览 0 评论 0原文

ML的Ref类型面对并发访问有访问保证吗?

Are there any access guarantees with ML's Ref type in the face of concurrent access?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

最美不过初阳 2024-10-03 18:27:37

我希望至少引用访问本身是原子的(例如永远不会引用无效的内存位置:-)。但是,这取决于实现,因为线程不是 ML/SML 规范的一部分。

“波动性”(跨线程/处理器读/写引用的一致视图)以及对底层对象的任何访问至少是另外两个需要考虑的事情。再次询问并发的实现。

I would hope that at least the ref access is atomic in itself (e.g. never have a ref to an invalid memory location :-). However, it'd depend on the implementation as threads are not part of the ML/SML spec afaik.

The 'volatility' (consistent view of the read/write to the ref across threads/processors), as well as any access to the underlying object are at least two other thing which need to be considered. Again, ask the implementation with concurrency.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文