Skip to content

Is it possible to use this queue with any moveable types? #5

Discussion options

You must be logged in to vote

In order to provide non-blocking atomic operation on the queue entries, each entry must be 16 bytes or less, as the hardware atomic operations which are non-blocking are limited to 16 bytes, ( DWCAS, see below). The Queue requires 32 bits for internal entry state, which leaves the transferable data type to 12 bytes.

To use the queue with movable objects of 12 bytes or less, you can see the queue implementation that transfers std::unique_ptr<> in the header file: pointer_mpmc_queue.h - it uses the reset() and release() methods to keep a single owner to the target object.

In case you need to transfer bigger objects, you might want to use the std::unique_ptr as the transferable units.
Note: …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@DeveloperPaul123
Comment options

Answer selected by erez-strauss
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants