Add ordered lock for time offset mutex

This commit is contained in:
Wildan M
2026-02-25 11:42:17 +07:00
parent 735c68ec30
commit 3c2b1a11c5
18 changed files with 59 additions and 47 deletions
+9 -5
View File
@@ -71,7 +71,7 @@ impl<T> WaitQueue<T> {
}
}
}
pub fn receive_into_user(
pub fn receive_into_user(
&self,
buf: UserSliceWo,
block: bool,
@@ -82,13 +82,16 @@ pub fn receive_into_user(
loop {
let mut preempt = PreemptGuard::new(&current_context_ref, token);
let mut inner = self.inner.lock(preempt.token().token());
if inner.is_empty() {
if block {
let (_, mut inner_token) = inner.token_split();
if !self.condition.wait_setup(&current_context_ref, reason, inner_token.token()) {
if !self
.condition
.wait_setup(&current_context_ref, reason, inner_token.token())
{
return Err(Error::new(EINTR));
}
@@ -97,8 +100,9 @@ pub fn receive_into_user(
context::switch(token);
self.condition.wait_cleanup(&current_context_ref, token.token());
self.condition
.wait_cleanup(&current_context_ref, token.token());
continue;
} else if buf.is_empty() {
return Ok(0);