我的代码如下所示,我使用.begin()来获取集合中的第一个元素,并且可以正确地获取它,但是使用.unsafe_erase(迭代器)通常会崩溃。当然,第一行(WriteGuard)是一个写锁。


我不知道为什么会这样,有没有人能给我一些建议,提前谢谢
发布于 2021-11-08 07:19:24
concurrent_set/ concurrent _multiset支持并发插入和遍历,但不支持并发擦除。有关更多详细信息,请参阅以下链接:https://spec.oneapi.io/versions/0.5.0/oneTBB/containers/concurrent_set_cls.html
从oneTBB 2021开始,concurrent_set的实施在内部发生了变化。您可以尝试使用最新版本的oneTBB (2021.4)。
您可以从以下链接下载oneTBB独立组件:https://www.intel.com/content/www/us/en/developer/articles/tool/oneapi-standalone-components.html
您也可以尝试使用开源oneTBB
https://stackoverflow.com/questions/69780451
复制相似问题