File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed
library/std/src/sys/windows Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -518,6 +518,17 @@ compat_fn_with_fallback! {
518
518
SetLastError ( ERROR_CALL_NOT_IMPLEMENTED as DWORD ) ;
519
519
FALSE
520
520
}
521
+
522
+ // >= NT 4+
523
+ // https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-switchtothread
524
+ pub fn SwitchToThread ( ) -> BOOL {
525
+ // A value of zero causes the thread to relinquish the remainder of its time slice to any
526
+ // other thread of equal priority that is ready to run. If there are no other threads of
527
+ // equal priority ready to run, the function returns immediately, and the thread continues
528
+ // execution.
529
+ Sleep ( 0 ) ;
530
+ TRUE
531
+ }
521
532
}
522
533
523
534
compat_fn_optional ! {
Original file line number Diff line number Diff line change @@ -2549,7 +2549,6 @@ Windows.Win32.System.Threading.STARTF_USESIZE
2549
2549
Windows.Win32.System.Threading.STARTF_USESTDHANDLES
2550
2550
Windows.Win32.System.Threading.STARTUPINFOW
2551
2551
Windows.Win32.System.Threading.STARTUPINFOW_FLAGS
2552
- Windows.Win32.System.Threading.SwitchToThread
2553
2552
Windows.Win32.System.Threading.TerminateProcess
2554
2553
Windows.Win32.System.Threading.THREAD_CREATE_RUN_IMMEDIATELY
2555
2554
Windows.Win32.System.Threading.THREAD_CREATE_SUSPENDED
Original file line number Diff line number Diff line change @@ -408,10 +408,6 @@ extern "system" {
408
408
pub fn SleepEx ( dwmilliseconds : u32 , balertable : BOOL ) -> u32 ;
409
409
}
410
410
#[ link( name = "kernel32" ) ]
411
- extern "system" {
412
- pub fn SwitchToThread ( ) -> BOOL ;
413
- }
414
- #[ link( name = "kernel32" ) ]
415
411
extern "system" {
416
412
pub fn TerminateProcess ( hprocess : HANDLE , uexitcode : u32 ) -> BOOL ;
417
413
}
You can’t perform that action at this time.
0 commit comments