1e2841179SLoGin // #![allow(dead_code)] 22f6f547aSGnoCiYeH use core::intrinsics::unlikely; 32f6f547aSGnoCiYeH 41496ba7bSLoGin use alloc::{collections::LinkedList, sync::Arc, vec::Vec}; 5c8025a88Slogin 6151251b5Slogin use crate::{ 7*f0c87a89SGnoCiYeH arch::CurrentIrqArch, 8f678331aShanjiezhou exception::InterruptArch, 91496ba7bSLoGin kerror, 101496ba7bSLoGin process::{ProcessControlBlock, ProcessManager, ProcessState}, 11*f0c87a89SGnoCiYeH sched::{schedule, SchedMode}, 12151251b5Slogin }; 13151251b5Slogin 14151251b5Slogin use super::{ 15151251b5Slogin mutex::MutexGuard, 16151251b5Slogin spinlock::{SpinLock, SpinLockGuard}, 17151251b5Slogin }; 18c8025a88Slogin 19151251b5Slogin #[derive(Debug)] 20151251b5Slogin struct InnerWaitQueue { 21151251b5Slogin /// 等待队列的链表 221496ba7bSLoGin wait_list: LinkedList<Arc<ProcessControlBlock>>, 23151251b5Slogin } 24151251b5Slogin 25151251b5Slogin /// 被自旋锁保护的等待队列 26151251b5Slogin #[derive(Debug)] 27151251b5Slogin pub struct WaitQueue(SpinLock<InnerWaitQueue>); 28151251b5Slogin 29e2841179SLoGin #[allow(dead_code)] 30151251b5Slogin impl WaitQueue { 31b5b571e0SLoGin pub const fn default() -> Self { 32b5b571e0SLoGin WaitQueue(SpinLock::new(InnerWaitQueue::INIT)) 33b5b571e0SLoGin } 34151251b5Slogin 35151251b5Slogin /// @brief 让当前进程在等待队列上进行等待,并且,允许被信号打断 36151251b5Slogin pub fn sleep(&self) { 3740609970SGnoCiYeH before_sleep_check(0); 381496ba7bSLoGin let mut guard: SpinLockGuard<InnerWaitQueue> = self.0.lock_irqsave(); 391496ba7bSLoGin ProcessManager::mark_sleep(true).unwrap_or_else(|e| { 401496ba7bSLoGin panic!("sleep error: {:?}", e); 411496ba7bSLoGin }); 421496ba7bSLoGin guard.wait_list.push_back(ProcessManager::current_pcb()); 43151251b5Slogin drop(guard); 44*f0c87a89SGnoCiYeH schedule(SchedMode::SM_NONE); 45151251b5Slogin } 46151251b5Slogin 47f678331aShanjiezhou /// @brief 让当前进程在等待队列上进行等待,并且,在释放waitqueue的锁之前,执行f函数闭包 48f678331aShanjiezhou pub fn sleep_with_func<F>(&self, f: F) 49f678331aShanjiezhou where 50f678331aShanjiezhou F: FnOnce(), 51f678331aShanjiezhou { 5240609970SGnoCiYeH before_sleep_check(0); 53f678331aShanjiezhou let mut guard: SpinLockGuard<InnerWaitQueue> = self.0.lock(); 541496ba7bSLoGin let irq_guard = unsafe { CurrentIrqArch::save_and_disable_irq() }; 551496ba7bSLoGin ProcessManager::mark_sleep(true).unwrap_or_else(|e| { 561496ba7bSLoGin panic!("sleep error: {:?}", e); 571496ba7bSLoGin }); 581496ba7bSLoGin drop(irq_guard); 591496ba7bSLoGin guard.wait_list.push_back(ProcessManager::current_pcb()); 60f678331aShanjiezhou f(); 612f6f547aSGnoCiYeH 62f678331aShanjiezhou drop(guard); 63*f0c87a89SGnoCiYeH schedule(SchedMode::SM_NONE); 64f678331aShanjiezhou } 65f678331aShanjiezhou 66f678331aShanjiezhou /// @brief 让当前进程在等待队列上进行等待. 但是,在释放waitqueue的锁之后,不会调用调度函数。 67f678331aShanjiezhou /// 这样的设计,是为了让调用者可以在执行本函数之后,执行一些操作,然后再【手动调用调度函数】。 68f678331aShanjiezhou /// 69f678331aShanjiezhou /// 执行本函数前,需要确保处于【中断禁止】状态。 70f678331aShanjiezhou /// 71f678331aShanjiezhou /// 尽管sleep_with_func和sleep_without_schedule都可以实现这个功能,但是,sleep_with_func会在释放锁之前,执行f函数闭包。 72f678331aShanjiezhou /// 73f678331aShanjiezhou /// 考虑这样一个场景: 74f678331aShanjiezhou /// 等待队列位于某个自旋锁保护的数据结构A中,我们希望在进程睡眠的同时,释放数据结构A的锁。 75f678331aShanjiezhou /// 在这种情况下,如果使用sleep_with_func,所有权系统不会允许我们这么做。 76f678331aShanjiezhou /// 因此,sleep_without_schedule的设计,正是为了解决这个问题。 77f678331aShanjiezhou /// 78f678331aShanjiezhou /// 由于sleep_without_schedule不会调用调度函数,因此,如果开发者忘记在执行本函数之后,手动调用调度函数, 79f678331aShanjiezhou /// 由于时钟中断到来或者‘其他cpu kick了当前cpu’,可能会导致一些未定义的行为。 80f678331aShanjiezhou pub unsafe fn sleep_without_schedule(&self) { 8140609970SGnoCiYeH before_sleep_check(1); 82f678331aShanjiezhou // 安全检查:确保当前处于中断禁止状态 83b5b571e0SLoGin assert!(!CurrentIrqArch::is_irq_enabled()); 84f678331aShanjiezhou let mut guard: SpinLockGuard<InnerWaitQueue> = self.0.lock(); 851496ba7bSLoGin ProcessManager::mark_sleep(true).unwrap_or_else(|e| { 861496ba7bSLoGin panic!("sleep error: {:?}", e); 871496ba7bSLoGin }); 881496ba7bSLoGin guard.wait_list.push_back(ProcessManager::current_pcb()); 891496ba7bSLoGin drop(guard); 901496ba7bSLoGin } 911496ba7bSLoGin 921496ba7bSLoGin pub unsafe fn sleep_without_schedule_uninterruptible(&self) { 938cb2e9b3SLoGin before_sleep_check(1); 941496ba7bSLoGin // 安全检查:确保当前处于中断禁止状态 95b5b571e0SLoGin assert!(!CurrentIrqArch::is_irq_enabled()); 961496ba7bSLoGin let mut guard: SpinLockGuard<InnerWaitQueue> = self.0.lock(); 971496ba7bSLoGin ProcessManager::mark_sleep(false).unwrap_or_else(|e| { 981496ba7bSLoGin panic!("sleep error: {:?}", e); 991496ba7bSLoGin }); 1001496ba7bSLoGin guard.wait_list.push_back(ProcessManager::current_pcb()); 101f678331aShanjiezhou drop(guard); 102f678331aShanjiezhou } 103151251b5Slogin /// @brief 让当前进程在等待队列上进行等待,并且,不允许被信号打断 104151251b5Slogin pub fn sleep_uninterruptible(&self) { 10540609970SGnoCiYeH before_sleep_check(0); 106151251b5Slogin let mut guard: SpinLockGuard<InnerWaitQueue> = self.0.lock(); 1071496ba7bSLoGin let irq_guard = unsafe { CurrentIrqArch::save_and_disable_irq() }; 1081496ba7bSLoGin ProcessManager::mark_sleep(false).unwrap_or_else(|e| { 1091496ba7bSLoGin panic!("sleep error: {:?}", e); 1101496ba7bSLoGin }); 1111496ba7bSLoGin drop(irq_guard); 1121496ba7bSLoGin guard.wait_list.push_back(ProcessManager::current_pcb()); 113151251b5Slogin drop(guard); 114*f0c87a89SGnoCiYeH schedule(SchedMode::SM_NONE); 115151251b5Slogin } 116151251b5Slogin 117151251b5Slogin /// @brief 让当前进程在等待队列上进行等待,并且,允许被信号打断。 118151251b5Slogin /// 在当前进程的pcb加入队列后,解锁指定的自旋锁。 119151251b5Slogin pub fn sleep_unlock_spinlock<T>(&self, to_unlock: SpinLockGuard<T>) { 12040609970SGnoCiYeH before_sleep_check(1); 121151251b5Slogin let mut guard: SpinLockGuard<InnerWaitQueue> = self.0.lock(); 1221496ba7bSLoGin let irq_guard = unsafe { CurrentIrqArch::save_and_disable_irq() }; 1231496ba7bSLoGin ProcessManager::mark_sleep(true).unwrap_or_else(|e| { 1241496ba7bSLoGin panic!("sleep error: {:?}", e); 1251496ba7bSLoGin }); 1261496ba7bSLoGin drop(irq_guard); 1271496ba7bSLoGin guard.wait_list.push_back(ProcessManager::current_pcb()); 128151251b5Slogin drop(to_unlock); 129151251b5Slogin drop(guard); 130*f0c87a89SGnoCiYeH schedule(SchedMode::SM_NONE); 131151251b5Slogin } 132151251b5Slogin 133151251b5Slogin /// @brief 让当前进程在等待队列上进行等待,并且,允许被信号打断。 134151251b5Slogin /// 在当前进程的pcb加入队列后,解锁指定的Mutex。 135151251b5Slogin pub fn sleep_unlock_mutex<T>(&self, to_unlock: MutexGuard<T>) { 13640609970SGnoCiYeH before_sleep_check(1); 137151251b5Slogin let mut guard: SpinLockGuard<InnerWaitQueue> = self.0.lock(); 1381496ba7bSLoGin let irq_guard = unsafe { CurrentIrqArch::save_and_disable_irq() }; 1391496ba7bSLoGin ProcessManager::mark_sleep(true).unwrap_or_else(|e| { 1401496ba7bSLoGin panic!("sleep error: {:?}", e); 1411496ba7bSLoGin }); 1421496ba7bSLoGin drop(irq_guard); 1431496ba7bSLoGin guard.wait_list.push_back(ProcessManager::current_pcb()); 144151251b5Slogin drop(to_unlock); 145151251b5Slogin drop(guard); 146*f0c87a89SGnoCiYeH schedule(SchedMode::SM_NONE); 147151251b5Slogin } 148151251b5Slogin 149151251b5Slogin /// @brief 让当前进程在等待队列上进行等待,并且,不允许被信号打断。 150151251b5Slogin /// 在当前进程的pcb加入队列后,解锁指定的自旋锁。 151151251b5Slogin pub fn sleep_uninterruptible_unlock_spinlock<T>(&self, to_unlock: SpinLockGuard<T>) { 15240609970SGnoCiYeH before_sleep_check(1); 153151251b5Slogin let mut guard: SpinLockGuard<InnerWaitQueue> = self.0.lock(); 1541496ba7bSLoGin let irq_guard = unsafe { CurrentIrqArch::save_and_disable_irq() }; 1551496ba7bSLoGin ProcessManager::mark_sleep(false).unwrap_or_else(|e| { 1561496ba7bSLoGin panic!("sleep error: {:?}", e); 1571496ba7bSLoGin }); 1581496ba7bSLoGin drop(irq_guard); 1591496ba7bSLoGin guard.wait_list.push_back(ProcessManager::current_pcb()); 160151251b5Slogin drop(to_unlock); 161151251b5Slogin drop(guard); 162*f0c87a89SGnoCiYeH schedule(SchedMode::SM_NONE); 163151251b5Slogin } 164151251b5Slogin 165151251b5Slogin /// @brief 让当前进程在等待队列上进行等待,并且,不允许被信号打断。 166151251b5Slogin /// 在当前进程的pcb加入队列后,解锁指定的Mutex。 167151251b5Slogin pub fn sleep_uninterruptible_unlock_mutex<T>(&self, to_unlock: MutexGuard<T>) { 16840609970SGnoCiYeH before_sleep_check(1); 169151251b5Slogin let mut guard: SpinLockGuard<InnerWaitQueue> = self.0.lock(); 1701496ba7bSLoGin let irq_guard = unsafe { CurrentIrqArch::save_and_disable_irq() }; 1711496ba7bSLoGin ProcessManager::mark_sleep(false).unwrap_or_else(|e| { 1721496ba7bSLoGin panic!("sleep error: {:?}", e); 1731496ba7bSLoGin }); 1741496ba7bSLoGin drop(irq_guard); 1751496ba7bSLoGin 1761496ba7bSLoGin guard.wait_list.push_back(ProcessManager::current_pcb()); 1771496ba7bSLoGin 178151251b5Slogin drop(to_unlock); 179151251b5Slogin drop(guard); 180*f0c87a89SGnoCiYeH schedule(SchedMode::SM_NONE); 181151251b5Slogin } 182151251b5Slogin 183151251b5Slogin /// @brief 唤醒在队列中等待的第一个进程。 184151251b5Slogin /// 如果这个进程的state与给定的state进行and操作之后,结果不为0,则唤醒它。 185151251b5Slogin /// 1861496ba7bSLoGin /// @param state 用于判断的state,如果队列第一个进程与这个state相同,或者为None(表示不进行这个判断),则唤醒这个进程。 187151251b5Slogin /// 188151251b5Slogin /// @return true 成功唤醒进程 189151251b5Slogin /// @return false 没有唤醒进程 1901496ba7bSLoGin pub fn wakeup(&self, state: Option<ProcessState>) -> bool { 1910d6cf65aSLoGin let mut guard: SpinLockGuard<InnerWaitQueue> = self.0.lock_irqsave(); 192151251b5Slogin // 如果队列为空,则返回 193151251b5Slogin if guard.wait_list.is_empty() { 194151251b5Slogin return false; 195151251b5Slogin } 196151251b5Slogin // 如果队列头部的pcb的state与给定的state相与,结果不为0,则唤醒 1971496ba7bSLoGin if let Some(state) = state { 1980d6cf65aSLoGin if guard 1990d6cf65aSLoGin .wait_list 2000d6cf65aSLoGin .front() 2010d6cf65aSLoGin .unwrap() 2020d6cf65aSLoGin .sched_info() 2030d6cf65aSLoGin .inner_lock_read_irqsave() 2040d6cf65aSLoGin .state() 2050d6cf65aSLoGin != state 2060d6cf65aSLoGin { 207151251b5Slogin return false; 208151251b5Slogin } 209151251b5Slogin } 2101496ba7bSLoGin let to_wakeup = guard.wait_list.pop_front().unwrap(); 2110d6cf65aSLoGin drop(guard); 2121496ba7bSLoGin let res = ProcessManager::wakeup(&to_wakeup).is_ok(); 2131496ba7bSLoGin return res; 2141496ba7bSLoGin } 215151251b5Slogin 216cde5492fSlogin /// @brief 唤醒在队列中,符合条件的所有进程。 217cde5492fSlogin /// 2181496ba7bSLoGin /// @param state 用于判断的state,如果一个进程与这个state相同,或者为None(表示不进行这个判断),则唤醒这个进程。 2191496ba7bSLoGin pub fn wakeup_all(&self, state: Option<ProcessState>) { 220cde5492fSlogin let mut guard: SpinLockGuard<InnerWaitQueue> = self.0.lock_irqsave(); 221cde5492fSlogin // 如果队列为空,则返回 222cde5492fSlogin if guard.wait_list.is_empty() { 223cde5492fSlogin return; 224cde5492fSlogin } 225cde5492fSlogin 2261496ba7bSLoGin let mut to_push_back: Vec<Arc<ProcessControlBlock>> = Vec::new(); 227cde5492fSlogin // 如果队列头部的pcb的state与给定的state相与,结果不为0,则唤醒 228cde5492fSlogin while let Some(to_wakeup) = guard.wait_list.pop_front() { 229a03c4f9dSLoGin let mut wake = false; 2301496ba7bSLoGin if let Some(state) = state { 2310d6cf65aSLoGin if to_wakeup.sched_info().inner_lock_read_irqsave().state() == state { 232a03c4f9dSLoGin wake = true; 233a03c4f9dSLoGin } 234a03c4f9dSLoGin } else { 235a03c4f9dSLoGin wake = true; 236a03c4f9dSLoGin } 237a03c4f9dSLoGin 238a03c4f9dSLoGin if wake { 2391496ba7bSLoGin ProcessManager::wakeup(&to_wakeup).unwrap_or_else(|e| { 2401496ba7bSLoGin kerror!("wakeup pid: {:?} error: {:?}", to_wakeup.pid(), e); 2411496ba7bSLoGin }); 2421496ba7bSLoGin continue; 243a03c4f9dSLoGin } else { 244cde5492fSlogin to_push_back.push(to_wakeup); 245cde5492fSlogin } 246a03c4f9dSLoGin } 247a03c4f9dSLoGin 248cde5492fSlogin for to_wakeup in to_push_back { 249cde5492fSlogin guard.wait_list.push_back(to_wakeup); 250cde5492fSlogin } 251cde5492fSlogin } 252cde5492fSlogin 253151251b5Slogin /// @brief 获得当前等待队列的大小 254151251b5Slogin pub fn len(&self) -> usize { 255151251b5Slogin return self.0.lock().wait_list.len(); 256151251b5Slogin } 257151251b5Slogin } 258151251b5Slogin 259151251b5Slogin impl InnerWaitQueue { 260151251b5Slogin pub const INIT: InnerWaitQueue = InnerWaitQueue { 261151251b5Slogin wait_list: LinkedList::new(), 262151251b5Slogin }; 263151251b5Slogin } 26440609970SGnoCiYeH 26540609970SGnoCiYeH fn before_sleep_check(max_preempt: usize) { 26640609970SGnoCiYeH let pcb = ProcessManager::current_pcb(); 26740609970SGnoCiYeH if unlikely(pcb.preempt_count() > max_preempt) { 26840609970SGnoCiYeH kwarn!( 26940609970SGnoCiYeH "Process {:?}: Try to sleep when preempt count is {}", 2708cb2e9b3SLoGin pcb.pid().data(), 27140609970SGnoCiYeH pcb.preempt_count() 27240609970SGnoCiYeH ); 27340609970SGnoCiYeH } 27440609970SGnoCiYeH } 27540609970SGnoCiYeH 27640609970SGnoCiYeH /// 事件等待队列 27740609970SGnoCiYeH #[derive(Debug)] 27840609970SGnoCiYeH pub struct EventWaitQueue { 27940609970SGnoCiYeH wait_list: SpinLock<Vec<(u64, Arc<ProcessControlBlock>)>>, 28040609970SGnoCiYeH } 28140609970SGnoCiYeH 282dfe53cf0SGnoCiYeH impl Default for EventWaitQueue { 283dfe53cf0SGnoCiYeH fn default() -> Self { 284dfe53cf0SGnoCiYeH Self::new() 285dfe53cf0SGnoCiYeH } 286dfe53cf0SGnoCiYeH } 287dfe53cf0SGnoCiYeH 288e2841179SLoGin #[allow(dead_code)] 28940609970SGnoCiYeH impl EventWaitQueue { 29040609970SGnoCiYeH pub fn new() -> Self { 29140609970SGnoCiYeH Self { 292dfe53cf0SGnoCiYeH wait_list: SpinLock::new(Default::default()), 29340609970SGnoCiYeH } 29440609970SGnoCiYeH } 29540609970SGnoCiYeH 29640609970SGnoCiYeH /// ## 让当前进程在该队列上等待感兴趣的事件 29740609970SGnoCiYeH /// 29840609970SGnoCiYeH /// ### 参数 29940609970SGnoCiYeH /// - events: 进程感兴趣的事件,events最好是为位表示,一位表示一个事件 30040609970SGnoCiYeH /// 30140609970SGnoCiYeH /// 注意,使用前应该注意有可能其他地方定义了冲突的事件,可能会导致未定义行为 30240609970SGnoCiYeH pub fn sleep(&self, events: u64) { 30340609970SGnoCiYeH before_sleep_check(0); 30440609970SGnoCiYeH let mut guard = self.wait_list.lock_irqsave(); 30540609970SGnoCiYeH ProcessManager::mark_sleep(true).unwrap_or_else(|e| { 30640609970SGnoCiYeH panic!("sleep error: {:?}", e); 30740609970SGnoCiYeH }); 30840609970SGnoCiYeH guard.push((events, ProcessManager::current_pcb())); 30940609970SGnoCiYeH drop(guard); 310*f0c87a89SGnoCiYeH schedule(SchedMode::SM_NONE); 31140609970SGnoCiYeH } 31240609970SGnoCiYeH 31340609970SGnoCiYeH pub unsafe fn sleep_without_schedule(&self, events: u64) { 31440609970SGnoCiYeH before_sleep_check(1); 31540609970SGnoCiYeH let mut guard = self.wait_list.lock_irqsave(); 31640609970SGnoCiYeH ProcessManager::mark_sleep(true).unwrap_or_else(|e| { 31740609970SGnoCiYeH panic!("sleep error: {:?}", e); 31840609970SGnoCiYeH }); 31940609970SGnoCiYeH guard.push((events, ProcessManager::current_pcb())); 32040609970SGnoCiYeH drop(guard); 32140609970SGnoCiYeH } 32240609970SGnoCiYeH 32340609970SGnoCiYeH pub fn sleep_unlock_spinlock<T>(&self, events: u64, to_unlock: SpinLockGuard<T>) { 32440609970SGnoCiYeH before_sleep_check(1); 3250d6cf65aSLoGin let mut guard = self.wait_list.lock_irqsave(); 32640609970SGnoCiYeH let irq_guard = unsafe { CurrentIrqArch::save_and_disable_irq() }; 32740609970SGnoCiYeH ProcessManager::mark_sleep(true).unwrap_or_else(|e| { 32840609970SGnoCiYeH panic!("sleep error: {:?}", e); 32940609970SGnoCiYeH }); 33040609970SGnoCiYeH drop(irq_guard); 33140609970SGnoCiYeH guard.push((events, ProcessManager::current_pcb())); 33240609970SGnoCiYeH drop(to_unlock); 33340609970SGnoCiYeH drop(guard); 334*f0c87a89SGnoCiYeH schedule(SchedMode::SM_NONE); 33540609970SGnoCiYeH } 33640609970SGnoCiYeH 33740609970SGnoCiYeH /// ### 唤醒该队列上等待events的进程 33840609970SGnoCiYeH /// 33940609970SGnoCiYeH /// ### 参数 34040609970SGnoCiYeH /// - events: 发生的事件 34140609970SGnoCiYeH /// 34240609970SGnoCiYeH /// 需要注意的是,只要触发了events中的任意一件事件,进程都会被唤醒 34340609970SGnoCiYeH pub fn wakeup_any(&self, events: u64) -> usize { 34440609970SGnoCiYeH let mut ret = 0; 3450d6cf65aSLoGin 3460d6cf65aSLoGin let mut wq_guard = self.wait_list.lock_irqsave(); 3470d6cf65aSLoGin wq_guard.retain(|(es, pcb)| { 34840609970SGnoCiYeH if *es & events > 0 { 34940609970SGnoCiYeH // 有感兴趣的事件 35040609970SGnoCiYeH if ProcessManager::wakeup(pcb).is_ok() { 35140609970SGnoCiYeH ret += 1; 35240609970SGnoCiYeH return false; 3530e7c4693SGnoCiYeH } else { 3540e7c4693SGnoCiYeH return true; 35540609970SGnoCiYeH } 35640609970SGnoCiYeH } else { 3570e7c4693SGnoCiYeH return true; 35840609970SGnoCiYeH } 35940609970SGnoCiYeH }); 36040609970SGnoCiYeH ret 36140609970SGnoCiYeH } 36240609970SGnoCiYeH 36340609970SGnoCiYeH /// ### 唤醒该队列上等待events的进程 36440609970SGnoCiYeH /// 36540609970SGnoCiYeH /// ### 参数 36640609970SGnoCiYeH /// - events: 发生的事件 36740609970SGnoCiYeH /// 36840609970SGnoCiYeH /// 需要注意的是,只有满足所有事件的进程才会被唤醒 36940609970SGnoCiYeH pub fn wakeup(&self, events: u64) -> usize { 37040609970SGnoCiYeH let mut ret = 0; 3710d6cf65aSLoGin let mut wq_guard = self.wait_list.lock_irqsave(); 3720d6cf65aSLoGin wq_guard.retain(|(es, pcb)| { 37340609970SGnoCiYeH if *es == events { 37440609970SGnoCiYeH // 有感兴趣的事件 37540609970SGnoCiYeH if ProcessManager::wakeup(pcb).is_ok() { 37640609970SGnoCiYeH ret += 1; 37740609970SGnoCiYeH return false; 3780e7c4693SGnoCiYeH } else { 3790e7c4693SGnoCiYeH return true; 38040609970SGnoCiYeH } 38140609970SGnoCiYeH } else { 3820e7c4693SGnoCiYeH return true; 38340609970SGnoCiYeH } 38440609970SGnoCiYeH }); 38540609970SGnoCiYeH ret 38640609970SGnoCiYeH } 38740609970SGnoCiYeH 38840609970SGnoCiYeH pub fn wakeup_all(&self) { 38940609970SGnoCiYeH self.wakeup_any(u64::MAX); 39040609970SGnoCiYeH } 39140609970SGnoCiYeH } 392