Skip to content

Commit bc67cfe

Browse files
committed
Comment why swap is not used in dequeuing
1 parent e9c4a63 commit bc67cfe

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

src/queue.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ where
397397
// Swap buffers: previous dequeuing buffer become the enqueuing one
398398
let next_enqueuing = EnqueuingCapacity::new(next_buffer_index, next_capa - inserted_length);
399399
let mut backoff = 0;
400+
// `AtomicUsize::swap` cannot be used directly, as the queue might be closed concurrently
400401
while let Err(enq) = self.enqueuing_capacity.compare_exchange_weak(
401402
enqueuing.into_atomic(),
402403
next_enqueuing.with_closed(enqueuing).into_atomic(),

0 commit comments

Comments
 (0)