File tree Expand file tree Collapse file tree 5 files changed +40
-179
lines changed
sys_common/thread_parking Expand file tree Collapse file tree 5 files changed +40
-179
lines changed Original file line number Diff line number Diff line change 1+ use super :: abi;
2+ use super :: error:: expect_success_aborting;
3+ use super :: time:: with_tmos;
4+ use crate :: time:: Duration ;
5+
6+ pub type ThreadId = abi:: ID ;
7+
8+ pub use super :: task:: current_task_id_aborting as current;
9+
10+ pub fn park ( _hint : usize ) {
11+ match unsafe { abi:: slp_tsk ( ) } {
12+ abi:: E_OK | abi:: E_RLWAI => { }
13+ err => {
14+ expect_success_aborting ( err, & "slp_tsk" ) ;
15+ }
16+ }
17+ }
18+
19+ pub fn park_timeout ( dur : Duration , _hint : usize ) {
20+ match with_tmos ( dur, |tmo| unsafe { abi:: tslp_tsk ( tmo) } ) {
21+ abi:: E_OK | abi:: E_RLWAI | abi:: E_TMOUT => { }
22+ err => {
23+ expect_success_aborting ( err, & "tslp_tsk" ) ;
24+ }
25+ }
26+ }
27+
28+ pub fn unpark ( id : ThreadId , _hint : usize ) {
29+ match unsafe { abi:: wup_tsk ( id) } {
30+ // It is allowed to try to wake up a destroyed or unrelated task, so we ignore all
31+ // errors that could result from that situation.
32+ abi:: E_OK | abi:: E_NOEXS | abi:: E_OBJ | abi:: E_QOVR => { }
33+ err => {
34+ expect_success_aborting ( err, & "wup_tsk" ) ;
35+ }
36+ }
37+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -13,9 +13,9 @@ mod itron {
1313 pub ( super ) mod spin;
1414 pub ( super ) mod task;
1515 pub mod thread;
16+ pub mod thread_parking;
1617 pub ( super ) mod time;
1718 use super :: unsupported;
18- pub mod wait_flag;
1919}
2020
2121pub mod alloc;
@@ -43,8 +43,8 @@ pub use self::itron::thread;
4343pub mod memchr;
4444pub mod thread_local_dtor;
4545pub mod thread_local_key;
46+ pub use self :: itron:: thread_parking;
4647pub mod time;
47- pub use self :: itron:: wait_flag;
4848
4949mod rwlock;
5050
Original file line number Diff line number Diff line change @@ -14,12 +14,10 @@ cfg_if::cfg_if! {
1414 } else if #[ cfg( any(
1515 target_os = "netbsd" ,
1616 all( target_vendor = "fortanix" , target_env = "sgx" ) ,
17+ target_os = "solid_asp3" ,
1718 ) ) ] {
1819 mod id;
1920 pub use id:: Parker ;
20- } else if #[ cfg( target_os = "solid_asp3" ) ] {
21- mod wait_flag;
22- pub use wait_flag:: Parker ;
2321 } else if #[ cfg( any( windows, target_family = "unix" ) ) ] {
2422 pub use crate :: sys:: thread_parking:: Parker ;
2523 } else {
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments