3

继续问题为什么 boost lockfree freelist 大小限制为最多 65535 个对象?

在 64 位机器的情况下如何增加队列的大小。

typedef boost::lockfree::queue<int, boost::lockfree::fixed_size<true>> MyQueue;
MyQueue queue(1024*100); << how to increase the size to more than 65534?

Boost 实现向队列项添加了额外的标记位,以避免 ABA 问题。目前它使用 32 位值(16 位指针和 16 位标记)。

如何将其更改为使用 64 位值(指针 32 位,标签 32 位)?

将 tagged_index::tag_t 和 index_t 更改为基于 unin32_t 的 ba 就足够了吗?

4

1 回答 1

1

As pointed out, the answer is here: https://stackoverflow.com/a/14957828/1065190 (written by the implementer, Tim Blechmann):

for 64bit platforms one might be able to adapt the boost.lockfree code to use 32bit instead of 16bit indices. but it would require some non-trivial changes to implement things correctly.

于 2013-08-21T12:38:25.487 回答