Skip to content

Commit

Permalink
ensure retirement is always attempted
Browse files Browse the repository at this point in the history
  • Loading branch information
ibraheemdev committed Nov 7, 2024
1 parent 835901d commit 9ea6d0b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
13 changes: 0 additions & 13 deletions src/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,19 +459,6 @@ impl Collector {

// Safety: The batch is non-null.
let batch_entries = unsafe { (*batch).entries.as_mut_ptr() };

// If there are not enough entries in this batch to add to all active threads
// reservation lists, we have to try again later.
//
// Relaxed: the fence above already ensures that we see any threads that might
// have access to any objects in this batch. Any threads that were created
// after it will see their new values.
//
// Safety: Local batch pointers are valid until relamation.
if unsafe { (*batch).entries.len() } <= self.reservations.threads.load(Ordering::Relaxed) {
return;
}

let current_reservation = self.reservations.load(thread);
let mut marked = 0;

Expand Down
4 changes: 2 additions & 2 deletions tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ fn reentrant() {

#[test]
fn owned_guard() {
let collector = Collector::new().batch_size(5).epoch_frequency(None);
let collector = Collector::new().batch_size(5);
let dropped = Arc::new(AtomicUsize::new(0));

let objects = UnsafeSend(
Expand Down Expand Up @@ -462,7 +462,7 @@ fn owned_guard() {

#[test]
fn owned_guard_concurrent() {
let collector = Collector::new().batch_size(1).epoch_frequency(None);
let collector = Collector::new().batch_size(1);
let dropped = Arc::new(AtomicUsize::new(0));

let objects = UnsafeSend(
Expand Down

0 comments on commit 9ea6d0b

Please sign in to comment.