File tree 5 files changed +40
-179
lines changed
sys_common/thread_parking
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 {
13
13
pub ( super ) mod spin;
14
14
pub ( super ) mod task;
15
15
pub mod thread;
16
+ pub mod thread_parking;
16
17
pub ( super ) mod time;
17
18
use super :: unsupported;
18
- pub mod wait_flag;
19
19
}
20
20
21
21
pub mod alloc;
@@ -43,8 +43,8 @@ pub use self::itron::thread;
43
43
pub mod memchr;
44
44
pub mod thread_local_dtor;
45
45
pub mod thread_local_key;
46
+ pub use self :: itron:: thread_parking;
46
47
pub mod time;
47
- pub use self :: itron:: wait_flag;
48
48
49
49
mod rwlock;
50
50
Original file line number Diff line number Diff line change @@ -14,12 +14,10 @@ cfg_if::cfg_if! {
14
14
} else if #[ cfg( any(
15
15
target_os = "netbsd" ,
16
16
all( target_vendor = "fortanix" , target_env = "sgx" ) ,
17
+ target_os = "solid_asp3" ,
17
18
) ) ] {
18
19
mod id;
19
20
pub use id:: Parker ;
20
- } else if #[ cfg( target_os = "solid_asp3" ) ] {
21
- mod wait_flag;
22
- pub use wait_flag:: Parker ;
23
21
} else if #[ cfg( any( windows, target_family = "unix" ) ) ] {
24
22
pub use crate :: sys:: thread_parking:: Parker ;
25
23
} else {
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments