我是否需要通过锁来保护对 Boost MultiIndex 索引(索引本身)的访问?
Do I need to protect access to a Boost MultiIndex's index (the index itself) by a lock?
假设我有一个提升::multi_index_container并想访问它的索引
boost::multi_index_container< ... > bmi;
// lock here?
auto &index = boost::multi_index::get<0>(bmi); // <-- does this call need to be protected by a lock?
// or is it sufficient to lock here?
// access the index (need to have the lock here)
当多个进程/线程访问一个multi_indesx_container时,我需要使用互斥锁(或类似的东西)。但是,我是否也需要保护获取索引本身?我想不是,但在文档中找不到保证。
尽管它没有在任何地方记录,但get()
是一个静态强制转换操作,本质上是线程安全的。
相关文章:
- 数组索引的值没有增加
- 芬威克树(BIT).找到具有给定累积频率的最小索引,单位为 O(logN)
- 查找最接近的大于当前数字的数字的索引
- 在C++中调整向量中的索引
- 重载元组索引运算符-C++
- 给定一个向量,如何找到该向量的所有子集和的原始索引
- 为std::string的某个索引赋值
- 并行用于C++17中数组索引范围内的循环
- 跟随整数索引列表的自定义类迭代器
- 如何在for循环中包含两个索引值的测试条件
- D3D11-将混合权重和索引传递到顶点着色器
- 将转换字符键入 int 以用作向量C++的索引
- 在 C++ 中访问数组负索引处的内存不会返回垃圾
- 如何为圆环创建索引
- 在子集化后将包含索引号的列表列表映射到标准索引序列
- 查找字符在两个索引之间出现的次数
- Azure Kinect 使用正文索引映射裁剪正文
- 如何查找哪个类对象位于数组的特定索引上(多态性)
- 如何将值插入到 c++ boost::multiindex 集合的特定索引中,就像在 std::list 中一样
- 我是否需要通过锁来保护对 Boost MultiIndex 索引(索引本身)的访问?