forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#106372 - joboet:solid_id_parking, r=m-ou-se
Use id-based thread parking on SOLID By using the [`slp_tsk`/`wup_tsk`](https://cs.uwaterloo.ca/~brecht/courses/702/Possible-Readings/embedded/uITRON-4.0-specification.pdf) system functions instead of an event-flag structure, `Parker` becomes cheaper to construct and SOLID can share the implementation used by NetBSD and SGX. ping `@kawadakk` r? `@m-ou-se` `@rustbot` label +T-libs
- Loading branch information
Showing
5 changed files
with
40 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use super::abi; | ||
use super::error::expect_success_aborting; | ||
use super::time::with_tmos; | ||
use crate::time::Duration; | ||
|
||
pub type ThreadId = abi::ID; | ||
|
||
pub use super::task::current_task_id_aborting as current; | ||
|
||
pub fn park(_hint: usize) { | ||
match unsafe { abi::slp_tsk() } { | ||
abi::E_OK | abi::E_RLWAI => {} | ||
err => { | ||
expect_success_aborting(err, &"slp_tsk"); | ||
} | ||
} | ||
} | ||
|
||
pub fn park_timeout(dur: Duration, _hint: usize) { | ||
match with_tmos(dur, |tmo| unsafe { abi::tslp_tsk(tmo) }) { | ||
abi::E_OK | abi::E_RLWAI | abi::E_TMOUT => {} | ||
err => { | ||
expect_success_aborting(err, &"tslp_tsk"); | ||
} | ||
} | ||
} | ||
|
||
pub fn unpark(id: ThreadId, _hint: usize) { | ||
match unsafe { abi::wup_tsk(id) } { | ||
// It is allowed to try to wake up a destroyed or unrelated task, so we ignore all | ||
// errors that could result from that situation. | ||
abi::E_OK | abi::E_NOEXS | abi::E_OBJ | abi::E_QOVR => {} | ||
err => { | ||
expect_success_aborting(err, &"wup_tsk"); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.