Rename (Posix)ThreadExt to As(Posix)Thread

This commit is contained in:
Ruihan Li
2024-11-12 09:53:01 +08:00
committed by Tate, Hongliang Tian
parent 9233d1cdbb
commit e6c613f538
19 changed files with 30 additions and 30 deletions

View File

@ -5,7 +5,7 @@ use ostd::{
task::{Task, TaskOptions},
};
use super::{oops, status::ThreadStatus, Thread, ThreadExt};
use super::{oops, status::ThreadStatus, AsThread, Thread};
use crate::{prelude::*, sched::priority::Priority};
/// The inner data of a kernel thread.

View File

@ -162,13 +162,13 @@ impl Thread {
}
}
/// An extension trait for [`Thread`]-like types.
pub trait ThreadExt {
/// A trait to provide the `as_thread` method for tasks.
pub trait AsThread {
/// Returns the associated [`Thread`].
fn as_thread(&self) -> Option<&Arc<Thread>>;
}
impl ThreadExt for Task {
impl AsThread for Task {
fn as_thread(&self) -> Option<&Arc<Thread>> {
self.data().downcast_ref::<Arc<Thread>>()
}

View File

@ -10,7 +10,7 @@ use crate::{
cpu::LinuxAbi,
get_current_userspace,
prelude::*,
process::{posix_thread::PosixThreadExt, signal::handle_pending_signal},
process::{posix_thread::AsPosixThread, signal::handle_pending_signal},
syscall::handle_syscall,
thread::exception::handle_exception,
vm::vmar::is_userspace_vaddr,

View File

@ -11,7 +11,7 @@ use super::worker_pool::WorkerPool;
use crate::{
prelude::*,
sched::priority::{Priority, PriorityRange},
thread::{kernel_thread::ThreadOptions, ThreadExt},
thread::{kernel_thread::ThreadOptions, AsThread},
};
/// A worker thread. A `Worker` will attempt to retrieve unfinished

View File

@ -17,7 +17,7 @@ use super::{simple_scheduler::SimpleScheduler, worker::Worker, WorkItem, WorkPri
use crate::{
prelude::*,
sched::priority::{Priority, PriorityRange},
thread::{kernel_thread::ThreadOptions, ThreadExt},
thread::{kernel_thread::ThreadOptions, AsThread},
};
/// A pool of workers.