File tree Expand file tree Collapse file tree 2 files changed +44
-1
lines changed
library/std/src/sys/pal/vexos Expand file tree Collapse file tree 2 files changed +44
-1
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ pub mod pipe;
13
13
#[ path = "../unsupported/process.rs" ]
14
14
pub mod process;
15
15
pub mod stdio;
16
- #[ path = "../unsupported/thread.rs" ]
17
16
pub mod thread;
18
17
pub mod time;
19
18
Original file line number Diff line number Diff line change
1
+ use super :: unsupported;
2
+ use crate :: ffi:: CStr ;
3
+ use crate :: io;
4
+ use crate :: num:: NonZero ;
5
+ use crate :: time:: Duration ;
6
+
7
+ pub struct Thread ( !) ;
8
+
9
+ pub const DEFAULT_MIN_STACK_SIZE : usize = 64 * 1024 ;
10
+
11
+ impl Thread {
12
+ // unsafe: see thread::Builder::spawn_unchecked for safety requirements
13
+ pub unsafe fn new ( _stack : usize , _p : Box < dyn FnOnce ( ) > ) -> io:: Result < Thread > {
14
+ unsupported ( )
15
+ }
16
+
17
+ pub fn yield_now ( ) {
18
+ unsafe {
19
+ vex_sdk:: vexTasksRun ( ) ;
20
+ }
21
+ }
22
+
23
+ pub fn set_name ( _name : & CStr ) {
24
+ // nope
25
+ }
26
+
27
+ pub fn sleep ( dur : Duration ) {
28
+ let start = Instant :: now ( ) ;
29
+
30
+ while start. elapsed ( ) < dur {
31
+ unsafe {
32
+ vex_sdk:: vexTasksRun ( ) ;
33
+ }
34
+ }
35
+ }
36
+
37
+ pub fn join ( self ) {
38
+ self . 0
39
+ }
40
+ }
41
+
42
+ pub fn available_parallelism ( ) -> io:: Result < NonZero < usize > > {
43
+ unsupported ( )
44
+ }
You can’t perform that action at this time.
0 commit comments