Skip to content

Commit

Permalink
fix: remove extra length check in clone
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Sep 27, 2023
1 parent aa7ee7a commit 50d0bf8
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -765,12 +765,6 @@ fn test_non_lockfree_unchecked() {

impl<T: Copy + Clone> Clone for LockFreeFrozenVec<T> {
fn clone(&self) -> Self {
let len = self.len.load(Ordering::Acquire);
// handle the empty case
if len == 0 {
return Self::default();
}

let mut coppied_data = [Self::NULL; NUM_BUFFERS];
// for each buffer, copy the data
unsafe {
Expand All @@ -788,7 +782,7 @@ impl<T: Copy + Clone> Clone for LockFreeFrozenVec<T> {

return Self {
data: coppied_data,
len: AtomicUsize::new(len),
len: AtomicUsize::new(self.len.load(Ordering::Relaxed)),
locked: AtomicBool::new(false),
};
}
Expand Down

0 comments on commit 50d0bf8

Please sign in to comment.