Dynamic MPMCQueue: Eliminate cases of enqueue indefinite blocking and failure...
Dynamic MPMCQueue: Eliminate cases of enqueue indefinite blocking and failure in the extensible version that impossible under the default pre-allocated version Summary: Currently under the extensible version (Dynamic == true), some enqueue operations may block indefinitely or fail (return false) even though such outcomes are impossible under the default (Dynamic == false) pre-allocated version. This diff eliminates such cases by changing the algorithms for the extensible version. Some of the high-level changes: - The offset formula for an expansion guarantees that no enqueue operation left behind in a closed array does not have an existing dequeue operation that unblocks it. The old formula was 1 + max(head, tail). The new formula is max(head, current offset) + current capacity. - Conditional operations validate state after the success of CAS. Reviewed By: djwatson Differential Revision: D5701013 fbshipit-source-id: 4917c5b35b7e2a2fddfd2e11fb5aeb478502137c
Showing
This diff is collapsed.
Please register or sign in to comment