From 0a99049c4bf850fff509ec2b7c2fd0955d00970d Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sun, 8 Oct 2023 20:59:26 +0800 Subject: [PATCH] 1 --- src/timer.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/timer.rs b/src/timer.rs index 944b893..8cb781c 100644 --- a/src/timer.rs +++ b/src/timer.rs @@ -22,7 +22,7 @@ struct TimerList { holder: Rc::>, wp: Rc::>>, timer_entry: Rc::>>, - attach_entry: Rc::>>, + attach_entry: Rc::>>, timer_type: i8, expire_time: i32, expires: i64, @@ -93,6 +93,12 @@ impl Timer { expires: 0, cb: None, })); + p.borrow_mut().holder = p.clone(); + p.borrow_mut().wp = Rc::new(p.borrow().holder.clone()); + p.borrow_mut().timer_entry = crate::ListHead::::new_node( + Rc::downgrade(&p.borrow().holder) + ); + p.borrow_mut().attach_entry = crate::ListHead::::new_head(); } return p; }