1
This commit is contained in:
parent
df628ccb8f
commit
0611d8063c
@ -47,7 +47,7 @@ impl<T> ListHeadLock<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn del_init(&mut self) {
|
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.prev.upgrade().unwrap().lock().unwrap().next = self.next.clone();
|
||||||
self.init();
|
self.init();
|
||||||
}
|
}
|
||||||
|
@ -34,11 +34,12 @@ impl<T> QueueLock<T> {
|
|||||||
crate::ListHeadLock::<T>::add_tail(&self.msg_list.lock().unwrap(), node);
|
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() &&
|
if !self.msg_list.lock().unwrap().lock().unwrap().empty() &&
|
||||||
self.work_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());
|
crate::ListHeadLock::replace_init(&self.msg_list.lock().unwrap(), &self.work_list.lock().unwrap());
|
||||||
}
|
}
|
||||||
|
return self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn empty(&self) -> bool {
|
pub fn empty(&self) -> bool {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user