gcc的STL空方法是线程安全的吗?
如果我有一个在不同线程上操作的双端队列或列表,我可以在没有锁的情况下调用空吗?该标准没有提及任何有关线程的内容,所以我知道这不会是可移植的,但我正在使用 gcc 4.4。我也很想知道这在其他实现上是否安全,以防我决定切换到英特尔编译器。但最重要的是,我关心 gcc。
If I have a deque or list that's being manipulated on different threads, can I call empty without a lock? The standard doesn't say anything about threads, so I know this won't be portable, but I'm using gcc 4.4. I'm also curious to know if this is safe on other implementations in case I ever decide to, say, switch to the intel compiler. But mostly, I care about gcc.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,你必须提供线程安全。
No. You have to provide the thread safety.