Skip to content

Conversation

jafar75
Copy link

@jafar75 jafar75 commented Apr 18, 2025

#1179
This PR attempts to provide a simplified version of push and pop for crossbeam-queue data structures. By having an exclusive reference, there is no need to do CAS operations and some other checks.

  • compare_exchange operations are removed
  • all atomic load and store operations are done with Relaxed ordering.
  • No need for backoff

@jafar75
Copy link
Author

jafar75 commented Apr 18, 2025

About drop block inside pop_mut, I think it is possible to do as below:

if offset + 1 == BLOCK_CAP {
    for i in 0..BLOCK_CAP - 1 {
        let slot = (*block).slots.get_unchecked(i);
        slot.state.fetch_or(DESTROY, Ordering::Relaxed);
    }
    drop(Box::from_raw(block));
} else {
    slot.state.fetch_or(READ, Ordering::Relaxed);
}

But I don't sure it is better than using Block::destroy() or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant