1
This commit is contained in:
parent
28274dd028
commit
7cee6d5f61
12
src/timer.rs
12
src/timer.rs
@ -31,7 +31,7 @@ impl Default for TimerType {
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct TimerList {
|
||||
struct TimerList {
|
||||
holder: Rc::<RefCell::<TimerList>>,
|
||||
wp: Rc::<Rc::<RefCell::<TimerList>>>,
|
||||
timer_entry: Rc::<RefCell::<crate::ListHead<TimerList>>>,
|
||||
@ -89,12 +89,12 @@ impl Timer {
|
||||
}
|
||||
|
||||
fn new_timer_list(&mut self) -> Rc::<RefCell::<TimerList>> {
|
||||
let p: Rc::<RefCell::<TimerList>>;
|
||||
p = self.free_timer_list.borrow().first_entry().upgrade().unwrap();
|
||||
if Rc::weak_count(&p.borrow().wp) > 0 {
|
||||
p.borrow_mut().wp = Rc::new(p.borrow().holder.clone());
|
||||
}
|
||||
let mut p: Rc::<RefCell::<TimerList>>;
|
||||
if self.free_timer_list.borrow().empty() {
|
||||
p = self.free_timer_list.borrow().first_entry().upgrade().unwrap();
|
||||
if Rc::weak_count(&p.borrow().wp) > 0 {
|
||||
p.borrow_mut().wp = Rc::new(p.borrow().holder.clone());
|
||||
}
|
||||
} else {
|
||||
p = Rc::new(RefCell::new(TimerList{
|
||||
holder: Default::default(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user