1
0
Fork 0
forked from wry/wry

wait-for-sync-obj: clear tasks on shutdown

This commit is contained in:
Julian Orth 2025-07-19 00:38:48 +02:00
parent 0f2d63ef44
commit 90b945b780
2 changed files with 7 additions and 7 deletions

View file

@ -1073,6 +1073,7 @@ impl State {
self.cursor_user_groups.clear();
self.cursor_user_group_hardware_cursor.take();
self.cpu_worker.clear();
self.wait_for_sync_obj.clear();
}
pub fn remove_toplevel_id(&self, id: ToplevelIdentifier) {

View file

@ -87,6 +87,12 @@ impl WaitForSyncObj {
}
}
pub fn clear(&self) {
self.inner.ctx.take();
self.inner.busy.clear();
self.inner.idle.take();
}
pub fn set_ctx(&self, ctx: Option<Rc<SyncObjCtx>>) {
self.inner.ctx.set(ctx);
let busy_waiters: Vec<_> = self.inner.busy.lock().drain_values().collect();
@ -163,13 +169,6 @@ impl WaitForSyncObj {
}
}
impl Drop for WaitForSyncObj {
fn drop(&mut self) {
self.inner.busy.clear();
self.inner.idle.take();
}
}
impl WaiterInner {
async fn run(self: Rc<Self>) {
let mut buf = Buf::new(8);