This commit is contained in:
azw 2024-05-12 16:43:15 +08:00
parent df628ccb8f
commit 0611d8063c
2 changed files with 3 additions and 2 deletions

View File

@ -47,7 +47,7 @@ impl<T> ListHeadLock<T> {
}
pub fn del_init(&mut self) {
self.next.upgrade().unwrap().lock().unwrap()._self_wp = self.prev.clone();
self.next.upgrade().unwrap().lock().unwrap().prev = self.prev.clone();
self.prev.upgrade().unwrap().lock().unwrap().next = self.next.clone();
self.init();
}

View File

@ -34,11 +34,12 @@ impl<T> QueueLock<T> {
crate::ListHeadLock::<T>::add_tail(&self.msg_list.lock().unwrap(), node);
}
pub fn fetch(&self) {
pub fn fetch(&self) -> &Self {
if !self.msg_list.lock().unwrap().lock().unwrap().empty() &&
self.work_list.lock().unwrap().lock().unwrap().empty() {
crate::ListHeadLock::replace_init(&self.msg_list.lock().unwrap(), &self.work_list.lock().unwrap());
}
return self
}
pub fn empty(&self) -> bool {