-
-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
Currently, WaitCell's Wait future doesn't automatically deregister if the future is dropped before the waiting completes (e.g. in cancellation case).
This could lead to the Waker being held longer than it needs to be, potentially outliving the task itself.
I think this is fine, soundness wise, since an executor needs to unsafely guarantee that a TaskRef lives "long enough", e.g. with an Arc on a heap (that the Waker would hold), or 'static in no-std use cases.
wait_queue::Wait does deregister on drop, using PinnedDrop:
mycelium/maitake-sync/src/wait_queue.rs
Lines 1449 to 1455 in 82284c4
| #[pinned_drop] | |
| impl<Lock: ScopedRawMutex> PinnedDrop for Wait<'_, Lock> { | |
| fn drop(mut self: Pin<&mut Self>) { | |
| let this = self.project(); | |
| this.waiter.release(this.queue); | |
| } | |
| } |
Metadata
Metadata
Assignees
Labels
No labels