Skip to content

Commit

Permalink
fix api comments
Browse files Browse the repository at this point in the history
--------
1 Recover wait queue from wait list
2 Fix api comments

Signed-off-by: guoweikang <[email protected]>
  • Loading branch information
guoweikang committed Oct 22, 2024
1 parent 80f5fe1 commit b2e6261
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions api/arceos_posix_api/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ fn main() {
// TODO: generate size and initial content automatically.
let (mutex_size, mutex_init) = if cfg!(feature = "multitask") {
if cfg!(feature = "smp") {
(3, "{0, 0, 0}") // core::mem::transmute::<_, [usize; 6]>(axsync::Mutex::new(()))
(3, "{0, 0, 0}") // core::mem::transmute::<_, [usize; 3]>(axsync::Mutex::new(()))
} else {
(2, "{0, 0}") // core::mem::transmute::<_, [usize; 5]>(axsync::Mutex::new(()))
(2, "{0, 0}") // core::mem::transmute::<_, [usize; 2]>(axsync::Mutex::new(()))
}
} else {
(1, "{0}")
Expand Down
16 changes: 8 additions & 8 deletions modules/axtask/src/wait_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl WaitQueue {
}
}

/// Cancel events by removing the task from the wait list.
/// Cancel events by removing the task from the wait queue.
/// If `from_timer_list` is true, try to remove the task from the timer list.
fn cancel_events(&self, waiter: Node, _from_timer_list: bool) {
// SAFETY:
Expand All @@ -83,15 +83,15 @@ impl WaitQueue {
}
}

/// Blocks the current task and put it into the wait list, until other task
/// Blocks the current task and put it into the wait queue, until other task
/// notifies it.
pub fn wait(&self) {
let waiter = Arc::new(WaitTaskNode::from_current());
current_run_queue::<NoPreemptIrqSave>().blocked_resched(self.list.lock(), waiter.clone());
self.cancel_events(waiter, false);
}

/// Blocks the current task and put it into the wait list, until the given
/// Blocks the current task and put it into the wait queue, until the given
/// `condition` becomes true.
///
/// Note that even other tasks notify this task, it will not wake up until
Expand All @@ -114,7 +114,7 @@ impl WaitQueue {
self.cancel_events(waiter, false);
}

/// Blocks the current task and put it into the wait list, until other tasks
/// Blocks the current task and put it into the wait queue, until other tasks
/// notify it, or the given duration has elapsed.
#[cfg(feature = "irq")]
pub fn wait_timeout(&self, dur: core::time::Duration) -> bool {
Expand All @@ -138,7 +138,7 @@ impl WaitQueue {
timeout
}

/// Blocks the current task and put it into the wait list, until the given
/// Blocks the current task and put it into the wait queue, until the given
/// `condition` becomes true, or the given duration has elapsed.
///
/// Note that even other tasks notify this task, it will not wake up until
Expand Down Expand Up @@ -178,7 +178,7 @@ impl WaitQueue {
timeout
}

/// Wakes up one task in the wait list, usually the first one.
/// Wakes up one task in the wait queue, usually the first one.
///
/// If `resched` is true, the current task will be preempted when the
/// preemption is enabled.
Expand All @@ -192,7 +192,7 @@ impl WaitQueue {
}
}

/// Wakes all tasks in the wait list.
/// Wakes all tasks in the wait queue.
///
/// If `resched` is true, the current task will be preempted when the
/// preemption is enabled.
Expand All @@ -202,7 +202,7 @@ impl WaitQueue {
}
}

/// Wake up the given task in the wait list.
/// Wake up the given task in the wait queue.
///
/// If `resched` is true, the current task will be preempted when the
/// preemption is enabled.
Expand Down

0 comments on commit b2e6261

Please sign in to comment.