gcc的STL空方法是线程安全的吗?

发布于 2024-09-25 10:14:22 字数 140 浏览 4 评论 0原文

如果我有一个在不同线程上操作的双端队列或列表,我可以在没有锁的情况下调用空吗?该标准没有提及任何有关线程的内容,所以我知道这不会是可移植的,但我正在使用 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 技术交流群。

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

发布评论

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

评论(1

青丝拂面 2024-10-02 10:14:22

不,你必须提供线程安全。

No. You have to provide the thread safety.

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