fn try_gc_queue(addr: u64, queue: &Arc<FutexQueue>)Expand description
Removes the queue entry for addr from its bucket if the queue is empty.
Two-phase to avoid holding bucket_lock while checking emptiness (which
would require acquiring waiters under bucket, violating the intended
ordering of acquiring bucket before waiters):
Phase 1 : check under waiters: fast exit if non-empty.
Phase 2 : remove under bucket_lock: remove_if_empty re-verifies
emptiness while already holding the bucket lock. A new
waiter that enqueued between the two phases will be visible
in that re-check and will block the removal.
TOCTOU note: a task may enqueue between phase 1 and phase 2. This is
safe: remove_if_empty re-checks is_empty() under the bucket lock,
so a queue with live waiters is never removed.