File tree 24 files changed +60
-89
lines changed
24 files changed +60
-89
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ mod task_queue {
67
67
pub mod wait_notify {
68
68
use crate :: pin:: Pin ;
69
69
use crate :: sync:: Arc ;
70
- use crate :: sys_common :: thread_parking :: Parker ;
70
+ use crate :: sys :: sync :: Parker ;
71
71
72
72
pub struct Notifier ( Arc < Parker > ) ;
73
73
Original file line number Diff line number Diff line change @@ -30,8 +30,6 @@ pub mod thread;
30
30
pub mod thread_local_dtor;
31
31
#[ path = "../unix/thread_local_key.rs" ]
32
32
pub mod thread_local_key;
33
- #[ path = "../unsupported/thread_parking.rs" ]
34
- pub mod thread_parking;
35
33
#[ allow( non_upper_case_globals) ]
36
34
#[ path = "../unix/time.rs" ]
37
35
pub mod time;
Original file line number Diff line number Diff line change @@ -30,8 +30,6 @@ pub mod stdio;
30
30
pub mod thread;
31
31
#[ path = "../unsupported/thread_local_key.rs" ]
32
32
pub mod thread_local_key;
33
- #[ path = "../unsupported/thread_parking.rs" ]
34
- pub mod thread_parking;
35
33
pub mod time;
36
34
37
35
mod helpers;
Original file line number Diff line number Diff line change
1
+ // Only used on NetBSD. If other platforms start using id-based parking, use
2
+ // separate modules for each platform.
3
+ #![ cfg( target_os = "netbsd" ) ]
4
+
1
5
use crate :: ffi:: { c_int, c_void} ;
2
6
use crate :: ptr;
3
7
use crate :: time:: Duration ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ pub mod thread;
14
14
#[ cfg( target_thread_local) ]
15
15
pub mod thread_local_dtor;
16
16
pub mod thread_local_key;
17
- pub mod thread_parking;
18
17
pub mod time;
19
18
20
19
mod common;
Original file line number Diff line number Diff line change @@ -39,13 +39,6 @@ pub mod thread_local_dtor;
39
39
pub mod thread_local_key;
40
40
pub mod time;
41
41
42
- cfg_if:: cfg_if! {
43
- if #[ cfg( not( target_feature = "atomics" ) ) ] {
44
- #[ path = "../unsupported/thread_parking.rs" ]
45
- pub mod thread_parking;
46
- }
47
- }
48
-
49
42
#[ path = "../unsupported/common.rs" ]
50
43
#[ deny( unsafe_op_in_unsafe_fn) ]
51
44
#[ allow( unused) ]
Original file line number Diff line number Diff line change @@ -41,15 +41,6 @@ pub mod thread_local_key;
41
41
#[ path = "../wasi/time.rs" ]
42
42
pub mod time;
43
43
44
- cfg_if:: cfg_if! {
45
- if #[ cfg( target_feature = "atomics" ) ] {
46
- compile_error!( "The wasm32-wasip2 target does not support atomics" ) ;
47
- } else {
48
- #[ path = "../unsupported/thread_parking.rs" ]
49
- pub mod thread_parking;
50
- }
51
- }
52
-
53
44
#[ path = "../unsupported/common.rs" ]
54
45
#[ deny( unsafe_op_in_unsafe_fn) ]
55
46
#[ allow( unused) ]
Original file line number Diff line number Diff line change @@ -50,8 +50,6 @@ cfg_if::cfg_if! {
50
50
} else {
51
51
#[ path = "../unsupported/thread.rs" ]
52
52
pub mod thread;
53
- #[ path = "../unsupported/thread_parking.rs" ]
54
- pub mod thread_parking;
55
53
}
56
54
}
57
55
Original file line number Diff line number Diff line change @@ -33,7 +33,6 @@ pub mod stdio;
33
33
pub mod thread;
34
34
pub mod thread_local_dtor;
35
35
pub mod thread_local_key;
36
- pub mod thread_parking;
37
36
pub mod time;
38
37
cfg_if:: cfg_if! {
39
38
if #[ cfg( not( target_vendor = "uwp" ) ) ] {
Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ pub mod process;
18
18
pub mod stdio;
19
19
pub mod thread;
20
20
pub mod thread_local_key;
21
- pub mod thread_parking;
22
21
pub mod time;
23
22
24
23
#[ path = "../unsupported/common.rs" ]
Original file line number Diff line number Diff line change @@ -32,9 +32,6 @@ pub mod time;
32
32
#[ path = "../unsupported/thread.rs" ]
33
33
pub mod thread;
34
34
35
- #[ path = "../unsupported/thread_parking.rs" ]
36
- pub mod thread_parking;
37
-
38
35
mod abi;
39
36
40
37
use crate :: io as std_io;
Original file line number Diff line number Diff line change @@ -2,8 +2,10 @@ mod condvar;
2
2
mod mutex;
3
3
mod once;
4
4
mod rwlock;
5
+ mod thread_parking;
5
6
6
7
pub use condvar:: Condvar ;
7
8
pub use mutex:: Mutex ;
8
9
pub use once:: { Once , OnceState } ;
9
10
pub use rwlock:: RwLock ;
11
+ pub use thread_parking:: Parker ;
Original file line number Diff line number Diff line change 10
10
//! provided by libdispatch, as the underlying Mach semaphore is only dubiously
11
11
//! public.
12
12
13
+ #![ allow( non_camel_case_types) ]
14
+
13
15
use crate :: pin:: Pin ;
14
16
use crate :: sync:: atomic:: {
15
17
AtomicI8 ,
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ cfg_if:: cfg_if! {
2
+ if #[ cfg( any(
3
+ target_os = "linux" ,
4
+ target_os = "android" ,
5
+ all( target_arch = "wasm32" , target_feature = "atomics" ) ,
6
+ target_os = "freebsd" ,
7
+ target_os = "openbsd" ,
8
+ target_os = "dragonfly" ,
9
+ target_os = "fuchsia" ,
10
+ target_os = "hermit" ,
11
+ ) ) ] {
12
+ mod futex;
13
+ pub use futex:: Parker ;
14
+ } else if #[ cfg( any(
15
+ target_os = "netbsd" ,
16
+ all( target_vendor = "fortanix" , target_env = "sgx" ) ,
17
+ target_os = "solid_asp3" ,
18
+ ) ) ] {
19
+ mod id;
20
+ pub use id:: Parker ;
21
+ } else if #[ cfg( target_os = "windows" ) ] {
22
+ mod windows;
23
+ pub use windows:: Parker ;
24
+ } else if #[ cfg( all(
25
+ any(
26
+ target_os = "macos" ,
27
+ target_os = "ios" ,
28
+ target_os = "watchos" ,
29
+ target_os = "visionos" ,
30
+ target_os = "tvos" ,
31
+ ) ,
32
+ not( miri) ,
33
+ ) ) ] {
34
+ mod darwin;
35
+ pub use darwin:: Parker ;
36
+ } else if #[ cfg( target_os = "netbsd" ) ] {
37
+ mod netbsd;
38
+ pub use netbsd:: Parker ;
39
+ } else if #[ cfg( target_os = "xous" ) ] {
40
+ mod xous;
41
+ pub use xous:: Parker ;
42
+ } else if #[ cfg( target_family = "unix" ) ] {
43
+ mod pthread;
44
+ pub use pthread:: Parker ;
45
+ } else {
46
+ mod unsupported;
47
+ pub use unsupported:: Parker ;
48
+ }
49
+ }
Original file line number Diff line number Diff line change @@ -154,7 +154,7 @@ impl Parker {
154
154
// This implementation doesn't require `unsafe`, but other implementations
155
155
// may assume this is only called by the thread that owns the Parker.
156
156
//
157
- // For memory ordering, see std/src/sys_common/thread_parking/ futex.rs
157
+ // For memory ordering, see futex.rs
158
158
pub unsafe fn park ( self : Pin < & Self > ) {
159
159
// If we were previously notified then we consume this notification and
160
160
// return quickly.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change @@ -26,7 +26,6 @@ pub mod io;
26
26
pub mod lazy_box;
27
27
pub mod process;
28
28
pub mod thread_local_dtor;
29
- pub mod thread_parking;
30
29
pub mod wstr;
31
30
pub mod wtf8;
32
31
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -174,8 +174,8 @@ use crate::ptr::addr_of_mut;
174
174
use crate :: str;
175
175
use crate :: sync:: atomic:: { AtomicUsize , Ordering } ;
176
176
use crate :: sync:: Arc ;
177
+ use crate :: sys:: sync:: Parker ;
177
178
use crate :: sys:: thread as imp;
178
- use crate :: sys_common:: thread_parking:: Parker ;
179
179
use crate :: sys_common:: { AsInner , IntoInner } ;
180
180
use crate :: time:: { Duration , Instant } ;
181
181
You can’t perform that action at this time.
0 commit comments