@@ -22,7 +22,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
2222 let security = this. read_pointer ( security_op) ?;
2323
2424 // stacksize is ignored, but still needs to be a valid usize
25- let _ = this. read_scalar ( stacksize_op) ?. to_machine_usize ( this) ?;
25+ this. read_scalar ( stacksize_op) ?. to_machine_usize ( this) ?;
2626
2727 let start_routine = this. read_pointer ( start_op) ?;
2828
@@ -40,6 +40,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
4040 let stack_size_param_is_a_reservation =
4141 this. eval_windows ( "c" , "STACK_SIZE_PARAM_IS_A_RESERVATION" ) ?. to_u32 ( ) ?;
4242
43+ // we ignore the `STACK_SIZE_PARAM_IS_A_RESERVATION` flag
44+ // reserved stack memory cannot be observed by the program
4345 if flags != 0 && flags != stack_size_param_is_a_reservation {
4446 throw_unsup_format ! ( "unsupported `dwCreationFlags` {} in `CreateThread`" , flags)
4547 }
@@ -61,7 +63,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
6163 & mut self ,
6264 handle_op : & OpTy < ' tcx , Provenance > ,
6365 timeout_op : & OpTy < ' tcx , Provenance > ,
64- ) -> InterpResult < ' tcx > {
66+ ) -> InterpResult < ' tcx , u32 > {
6567 let this = self . eval_context_mut ( ) ;
6668
6769 let handle = this. read_scalar ( handle_op) ?. check_init ( ) ?;
@@ -70,8 +72,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
7072
7173 let thread = match Handle :: from_scalar ( handle, this) ? {
7274 Some ( Handle :: Thread ( thread) ) => thread,
73- // Unlike on posix, joining the current thread is not UB on windows .
74- // It will just deadlock .
75+ // Unlike on posix, the outcome of joining the current thread is not documented .
76+ // On current Windows, it just deadlocks .
7577 Some ( Handle :: Pseudo ( PseudoHandle :: CurrentThread ) ) => this. get_active_thread ( ) ,
7678 _ => this. invalid_handle ( "WaitForSingleObject" ) ?,
7779 } ;
@@ -82,6 +84,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
8284
8385 this. join_thread ( thread) ?;
8486
85- Ok ( ( ) )
87+ Ok ( 0 )
8688 }
8789}
0 commit comments