std: replace pthread RwLock
with custom implementation inspired by usync
This commit is contained in:
parent
972452c447
commit
934eb8b391
5 changed files with 506 additions and 198 deletions
|
@ -1063,7 +1063,7 @@ pub fn park() {
|
|||
let guard = PanicGuard;
|
||||
// SAFETY: park_timeout is called on the parker owned by this thread.
|
||||
unsafe {
|
||||
current().inner.as_ref().parker().park();
|
||||
current().park();
|
||||
}
|
||||
// No panic occurred, do not abort.
|
||||
forget(guard);
|
||||
|
@ -1290,6 +1290,15 @@ impl Thread {
|
|||
Thread { inner }
|
||||
}
|
||||
|
||||
/// Like the public [`park`], but callable on any handle. Used to allow
|
||||
/// parking in TLS destructors.
|
||||
///
|
||||
/// # Safety
|
||||
/// May only be called from the thread to which this handle belongs.
|
||||
pub(crate) unsafe fn park(&self) {
|
||||
unsafe { self.inner.as_ref().parker().park() }
|
||||
}
|
||||
|
||||
/// Atomically makes the handle's token available if it is not already.
|
||||
///
|
||||
/// Every thread is equipped with some basic low-level blocking support, via
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue