Windows lock primitives: check that we are truly sinle-threaded
This commit is contained in:
parent
1e87c9f8ba
commit
61a86e1ffe
@ -236,12 +236,14 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
|
||||
| "LeaveCriticalSection"
|
||||
| "DeleteCriticalSection" if this.frame().instance.to_string().starts_with("std::sys::windows::")
|
||||
=> {
|
||||
assert_eq!(this.get_total_thread_count()?, 1, "concurrency on Windows not supported");
|
||||
// Nothing to do, not even a return value.
|
||||
// (Windows locks are reentrant, and we have only 1 thread,
|
||||
// so not doing any futher checks here is at least not incorrect.)
|
||||
}
|
||||
"TryEnterCriticalSection" if this.frame().instance.to_string().starts_with("std::sys::windows::")
|
||||
=> {
|
||||
assert_eq!(this.get_total_thread_count()?, 1, "concurrency on Windows not supported");
|
||||
// There is only one thread, so this always succeeds and returns TRUE
|
||||
this.write_scalar(Scalar::from_i32(1), dest)?;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user