1
This commit is contained in:
parent
3247ff5f40
commit
b246bd745a
@ -9,11 +9,21 @@ pub struct ListHead<T> {
|
||||
|
||||
impl<T> ListHead<T> {
|
||||
|
||||
pub fn new() -> Rc::<RefCell::<ListHead<T>>> {
|
||||
pub fn new_head() -> Rc::<RefCell::<ListHead<T>>> {
|
||||
let this = Rc::new(RefCell::new(ListHead{
|
||||
prev: Weak::<RefCell::<ListHead<T>>>::new(),
|
||||
next: Weak::<RefCell::<ListHead<T>>>::new(),
|
||||
data: Weak::<RefCell::<T>>::new(),
|
||||
data: Weak::<RefCell::<T>>::new()
|
||||
}));
|
||||
this.borrow_mut().init();
|
||||
return this;
|
||||
}
|
||||
|
||||
pub fn new_node(data: Weak::<RefCell::<T>>) -> Rc::<RefCell::<ListHead<T>>> {
|
||||
let this = Rc::new(RefCell::new(ListHead{
|
||||
prev: Weak::<RefCell::<ListHead<T>>>::new(),
|
||||
next: Weak::<RefCell::<ListHead<T>>>::new(),
|
||||
data: data
|
||||
}));
|
||||
this.borrow_mut().init();
|
||||
return this;
|
||||
|
16
src/timer.rs
16
src/timer.rs
@ -33,7 +33,21 @@ impl Timer {
|
||||
get_tick_count: fn () -> i64,
|
||||
gctime: i32,
|
||||
cache_timer_num: i32) {
|
||||
|
||||
for i in 0..self.tv1.len() {
|
||||
self.tv1[i] = crate::ListHead::<TimerList>::new_head();
|
||||
}
|
||||
for i in 0..self.tv2.len() {
|
||||
self.tv2[i] = crate::ListHead::<TimerList>::new_head();
|
||||
}
|
||||
for i in 0..self.tv3.len() {
|
||||
self.tv3[i] = crate::ListHead::<TimerList>::new_head();
|
||||
}
|
||||
for i in 0..self.tv4.len() {
|
||||
self.tv4[i] = crate::ListHead::<TimerList>::new_head();
|
||||
}
|
||||
for i in 0..self.tv5.len() {
|
||||
self.tv5[i] = crate::ListHead::<TimerList>::new_head();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn uninit(&mut self) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user