mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-27 03:13:23 +00:00
Rename (Posix)ThreadExt
to As(Posix)Thread
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
9233d1cdbb
commit
e6c613f538
@ -9,7 +9,7 @@ use ostd::{
|
||||
};
|
||||
|
||||
use super::{
|
||||
posix_thread::{thread_table, PosixThread, PosixThreadBuilder, PosixThreadExt, ThreadName},
|
||||
posix_thread::{thread_table, AsPosixThread, PosixThread, PosixThreadBuilder, ThreadName},
|
||||
process_table,
|
||||
process_vm::ProcessVm,
|
||||
signal::{constants::SIGCHLD, sig_disposition::SigDispositions, sig_num::SigNum},
|
||||
@ -21,7 +21,7 @@ use crate::{
|
||||
get_current_userspace,
|
||||
prelude::*,
|
||||
process::posix_thread::allocate_posix_tid,
|
||||
thread::{ThreadExt, Tid},
|
||||
thread::{AsThread, Tid},
|
||||
};
|
||||
|
||||
bitflags! {
|
||||
|
@ -4,10 +4,10 @@ use super::{process_table, Pid, Process, TermStatus};
|
||||
use crate::{
|
||||
prelude::*,
|
||||
process::{
|
||||
posix_thread::{do_exit, PosixThreadExt},
|
||||
posix_thread::{do_exit, AsPosixThread},
|
||||
signal::signals::kernel::KernelSignal,
|
||||
},
|
||||
thread::ThreadExt,
|
||||
thread::AsThread,
|
||||
};
|
||||
|
||||
pub fn do_exit_group(term_status: TermStatus) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
use super::{
|
||||
posix_thread::{thread_table, PosixThreadExt},
|
||||
posix_thread::{thread_table, AsPosixThread},
|
||||
process_table,
|
||||
signal::{
|
||||
constants::SIGCONT,
|
||||
|
@ -22,7 +22,7 @@ use crate::{
|
||||
events::Observer,
|
||||
prelude::*,
|
||||
process::signal::constants::SIGCONT,
|
||||
thread::{Thread, ThreadExt, Tid},
|
||||
thread::{AsThread, Thread, Tid},
|
||||
time::{clocks::ProfClock, Timer, TimerManager},
|
||||
};
|
||||
|
||||
@ -37,7 +37,7 @@ pub mod thread_table;
|
||||
pub use builder::PosixThreadBuilder;
|
||||
pub use exit::do_exit;
|
||||
pub use name::{ThreadName, MAX_THREAD_NAME_LEN};
|
||||
pub use posix_thread_ext::{create_posix_task_from_executable, PosixThreadExt};
|
||||
pub use posix_thread_ext::{create_posix_task_from_executable, AsPosixThread};
|
||||
pub use robust_list::RobustListHead;
|
||||
|
||||
pub struct PosixThread {
|
||||
|
@ -11,22 +11,22 @@ use crate::{
|
||||
fs::fs_resolver::{FsPath, FsResolver, AT_FDCWD},
|
||||
prelude::*,
|
||||
process::{process_vm::ProcessVm, program_loader::load_program_to_vm, Credentials, Process},
|
||||
thread::{Thread, ThreadExt, Tid},
|
||||
thread::{AsThread, Thread, Tid},
|
||||
};
|
||||
|
||||
/// An extension trait for some [`PosixThread`]-like types.
|
||||
pub trait PosixThreadExt {
|
||||
/// A trait to provide the `as_posix_thread` method for tasks and threads.
|
||||
pub trait AsPosixThread {
|
||||
/// Returns the associated [`PosixThread`].
|
||||
fn as_posix_thread(&self) -> Option<&PosixThread>;
|
||||
}
|
||||
|
||||
impl PosixThreadExt for Thread {
|
||||
impl AsPosixThread for Thread {
|
||||
fn as_posix_thread(&self) -> Option<&PosixThread> {
|
||||
self.data().downcast_ref::<PosixThread>()
|
||||
}
|
||||
}
|
||||
|
||||
impl PosixThreadExt for Task {
|
||||
impl AsPosixThread for Task {
|
||||
fn as_posix_thread(&self) -> Option<&PosixThread> {
|
||||
self.as_thread()?.as_posix_thread()
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
use super::{Thread, Tid};
|
||||
use crate::{prelude::*, process::posix_thread::PosixThreadExt};
|
||||
use crate::{prelude::*, process::posix_thread::AsPosixThread};
|
||||
|
||||
static THREAD_TABLE: SpinLock<BTreeMap<Tid, Arc<Thread>>> = SpinLock::new(BTreeMap::new());
|
||||
|
||||
|
@ -4,7 +4,7 @@ use core::sync::atomic::{AtomicU32, Ordering};
|
||||
|
||||
use self::timer_manager::PosixTimerManager;
|
||||
use super::{
|
||||
posix_thread::{allocate_posix_tid, PosixThreadExt},
|
||||
posix_thread::{allocate_posix_tid, AsPosixThread},
|
||||
process_table,
|
||||
process_vm::{Heap, InitStackReader, ProcessVm},
|
||||
rlimit::ResourceLimits,
|
||||
@ -21,7 +21,7 @@ use crate::{
|
||||
fs::{file_table::FileTable, fs_resolver::FsResolver, utils::FileCreationMask},
|
||||
prelude::*,
|
||||
sched::priority::{AtomicNice, Nice},
|
||||
thread::{Thread, ThreadExt},
|
||||
thread::{AsThread, Thread},
|
||||
time::clocks::ProfClock,
|
||||
vm::vmar::Vmar,
|
||||
};
|
||||
|
@ -17,7 +17,7 @@ use ostd::{
|
||||
use super::Process;
|
||||
use crate::{
|
||||
process::{
|
||||
posix_thread::PosixThreadExt,
|
||||
posix_thread::AsPosixThread,
|
||||
signal::{constants::SIGALRM, signals::kernel::KernelSignal},
|
||||
},
|
||||
thread::{
|
||||
|
@ -7,8 +7,8 @@ use ostd::sync::{WaitQueue, Waiter};
|
||||
use super::sig_mask::SigMask;
|
||||
use crate::{
|
||||
prelude::*,
|
||||
process::posix_thread::PosixThreadExt,
|
||||
thread::ThreadExt,
|
||||
process::posix_thread::AsPosixThread,
|
||||
thread::AsThread,
|
||||
time::wait::{ManagedTimeout, TimeoutExt},
|
||||
};
|
||||
|
||||
|
@ -6,7 +6,7 @@ use super::{process_filter::ProcessFilter, signal::constants::SIGCHLD, ExitCode,
|
||||
use crate::{
|
||||
prelude::*,
|
||||
process::{
|
||||
posix_thread::{thread_table, PosixThreadExt},
|
||||
posix_thread::{thread_table, AsPosixThread},
|
||||
process_table,
|
||||
signal::with_signal_blocked,
|
||||
},
|
||||
|
Reference in New Issue
Block a user