@@ -286,6 +286,24 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
286286 let ret = this. TryAcquireSRWLockShared ( ptr) ?;
287287 this. write_scalar ( Scalar :: from_u8 ( ret) , dest) ?;
288288 }
289+ "SleepConditionVariableSRW" => {
290+ let [ condvar, lock, timeout, flags] =
291+ this. check_shim ( abi, Abi :: System { unwind : false } , link_name, args) ?;
292+
293+ this. SleepConditionVariableSRW ( condvar, lock, timeout, flags, dest) ?;
294+ }
295+ "WakeConditionVariable" => {
296+ let [ condvar] =
297+ this. check_shim ( abi, Abi :: System { unwind : false } , link_name, args) ?;
298+
299+ this. WakeConditionVariable ( condvar) ?;
300+ }
301+ "WakeAllConditionVariable" => {
302+ let [ condvar] =
303+ this. check_shim ( abi, Abi :: System { unwind : false } , link_name, args) ?;
304+
305+ this. WakeAllConditionVariable ( condvar) ?;
306+ }
289307
290308 // Dynamic symbol loading
291309 "GetProcAddress" => {
@@ -353,10 +371,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
353371 // FIXME: we should set last_error, but to what?
354372 this. write_null ( dest) ?;
355373 }
356- "SwitchToThread" => {
374+ // this is only callable from std because we know that std ignores the return value
375+ "SwitchToThread" if this. frame_in_std ( ) => {
357376 let [ ] = this. check_shim ( abi, Abi :: System { unwind : false } , link_name, args) ?;
358- // Note that once Miri supports concurrency, this will need to return a nonzero
359- // value if this call does result in switching to another thread.
377+
378+ this. yield_active_thread ( ) ;
379+
380+ // FIXME: this should return a nonzero value if this call does result in switching to another thread.
360381 this. write_null ( dest) ?;
361382 }
362383 "GetStdHandle" => {
@@ -469,10 +490,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
469490 // There is only one thread, so this always succeeds and returns TRUE.
470491 this. write_scalar ( Scalar :: from_i32 ( 1 ) , dest) ?;
471492 }
472- "GetCurrentThread" if this. frame_in_std ( ) => {
473- let [ ] = this. check_shim ( abi, Abi :: System { unwind : false } , link_name, args) ?;
474- this. write_scalar ( Scalar :: from_machine_isize ( 1 , this) , dest) ?;
475- }
476493 "GetCurrentProcessId" if this. frame_in_std ( ) => {
477494 let [ ] = this. check_shim ( abi, Abi :: System { unwind : false } , link_name, args) ?;
478495 let result = this. GetCurrentProcessId ( ) ?;
0 commit comments