mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-28 20:03:22 +00:00
Rename (Posix)ThreadExt
to As(Posix)Thread
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
9233d1cdbb
commit
e6c613f538
@ -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.
|
||||
|
@ -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>>()
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
Reference in New Issue
Block a user