Patches for the new borrow checker

This commit is contained in:
Zhang Junyang 2025-12-08 22:54:33 +08:00 committed by Tate, Hongliang Tian
parent fc9f47a019
commit 127290f70d
4 changed files with 15 additions and 14 deletions

View File

@ -55,15 +55,14 @@ pub(crate) struct CurrentUserSpace<'a>(Ref<'a, Option<Arc<Vmar>>>);
/// If you get the access to the [`Context`].
#[macro_export]
macro_rules! current_userspace {
() => {{
use $crate::{context::CurrentUserSpace, process::posix_thread::AsThreadLocal};
CurrentUserSpace::new(
ostd::task::Task::current()
.unwrap()
.as_thread_local()
.unwrap(),
() => {
$crate::context::CurrentUserSpace::new(
$crate::process::posix_thread::AsThreadLocal::as_thread_local(
&ostd::task::Task::current().unwrap(),
)
.unwrap(),
)
}};
};
}
impl<'a> CurrentUserSpace<'a> {

View File

@ -254,7 +254,7 @@ impl Drop for SemaphoreSet {
let pending_alter = &mut inner.pending_alter;
for pending_alter in pending_alter.iter_mut() {
pending_alter.set_status(Status::Removed);
if let Some(ref waker) = pending_alter.waker() {
if let Some(waker) = pending_alter.waker() {
waker.wake_up();
}
}
@ -263,7 +263,7 @@ impl Drop for SemaphoreSet {
let pending_const = &mut inner.pending_const;
for pending_const in pending_const.iter_mut() {
pending_const.set_status(Status::Removed);
if let Some(ref waker) = pending_const.waker() {
if let Some(waker) = pending_const.waker() {
waker.wake_up();
}
}

View File

@ -816,9 +816,9 @@ impl State {
fn iface(&self) -> Option<&Arc<Iface>> {
match self {
State::Init(_) => None,
State::Connecting(ref connecting_stream) => Some(connecting_stream.iface()),
State::Connected(ref connected_stream) => Some(connected_stream.iface()),
State::Listen(ref listen_stream) => Some(listen_stream.iface()),
State::Connecting(connecting_stream) => Some(connecting_stream.iface()),
State::Connected(connected_stream) => Some(connected_stream.iface()),
State::Listen(listen_stream) => Some(listen_stream.iface()),
}
}
}

View File

@ -100,7 +100,9 @@ pub struct PosixTimerManager {
posix_timers: Mutex<Vec<Option<Arc<Timer>>>>,
}
fn create_process_timer_callback(process_ref: &Weak<Process>) -> impl Fn(TimerGuard) + Clone {
fn create_process_timer_callback(
process_ref: &Weak<Process>,
) -> impl Fn(TimerGuard) + Clone + 'static {
let current_process = process_ref.clone();
let sent_signal = move || {
let signal = KernelSignal::new(SIGALRM);