Skip to content

Commit

Permalink
refactor: pop tasks before whole runtime shutdown (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
ihciah authored Aug 31, 2023
1 parent 716a9a3 commit 5b9c503
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions monoio/src/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ impl Default for TaskQueue {
}
}

impl Drop for TaskQueue {
fn drop(&mut self) {
unsafe {
let queue = &mut *self.queue.get();
while let Some(_task) = queue.pop_front() {}
}
}
}

impl TaskQueue {
pub(crate) fn new() -> Self {
const DEFAULT_TASK_QUEUE_SIZE: usize = 4096;
Expand Down

0 comments on commit 5b9c503

Please sign in to comment.