tokio/runtime/time_alt/
registration_queue.rs1use super::{Entry, EntryHandle, RegistrationQueueEntry};
2use crate::util::linked_list;
3
4type EntryList = linked_list::LinkedList<RegistrationQueueEntry, Entry>;
5
6#[derive(Debug)]
8pub(crate) struct RegistrationQueue {
9 list: EntryList,
10}
11
12impl Drop for RegistrationQueue {
13 fn drop(&mut self) {
14 while let Some(hdl) = self.list.pop_front() {
16 drop(hdl);
17 }
18 }
19}
20
21impl RegistrationQueue {
22 pub(crate) fn new() -> Self {
23 Self {
24 list: EntryList::new(),
25 }
26 }
27
28 pub(crate) unsafe fn push_front(&mut self, hdl: EntryHandle) {
34 self.list.push_front(hdl);
35 }
36
37 pub(crate) fn pop_front(&mut self) -> Option<EntryHandle> {
38 self.list.pop_front()
39 }
40}
41
42#[cfg(test)]
43mod tests;