Skip to content

Commit

Permalink
fix: 在插入新的timer时,边界条件判断不正确的问题 (DragonOS-Community#1091)
Browse files Browse the repository at this point in the history
修复split_pos 初始值错误导致原本应该被插入到链表末尾的定时器,插入到了链表头

Signed-off-by: longjin <[email protected]>
  • Loading branch information
fslongjin authored Mar 7, 2025
1 parent 597315b commit 6fa06ff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ cppcheck.xml
/target/
Cargo.lock
.cache
compile_commands.json
compile_commands.json
/logs/
2 changes: 1 addition & 1 deletion kernel/src/time/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ impl Timer {
let expire_jiffies = inner_guard.expire_jiffies;
let self_arc = inner_guard.self_ref.upgrade().unwrap();
drop(inner_guard);
let mut split_pos: usize = 0;
let mut split_pos: usize = timer_list.len();
for (pos, elt) in timer_list.iter().enumerate() {
if Arc::ptr_eq(&self_arc, &elt.1) {
warn!("Timer already in list");
Expand Down

0 comments on commit 6fa06ff

Please sign in to comment.