Various futex fixes

This commit is contained in:
Jacob Lorentzon
2024-04-05 20:31:06 +00:00
committed by Jeremy Soller
parent 7cf68bc8ee
commit 1fba2ef10a
10 changed files with 216 additions and 68 deletions
+7 -1
View File
@@ -10,6 +10,8 @@ use crate::{
use crate::platform::{types::*, Pal, Sys};
use super::FutexWaitResult;
pub struct RlctMutex {
// Actual locking word.
inner: AtomicUint,
@@ -123,7 +125,11 @@ impl RlctMutex {
// If the mutex is not robust, simply futex_wait until unblocked.
//crate::sync::futex_wait(&self.inner, inner | WAITING_BIT, None);
crate::sync::futex_wait(&self.inner, thread, None);
if crate::sync::futex_wait(&self.inner, thread, deadline)
== FutexWaitResult::TimedOut
{
return Err(Errno(ETIMEDOUT));
}
}
}
}