Skip to content

Commit a49234e

Browse files
committed
Auto merge of #1392 - RalfJung:win-lock-check, r=RalfJung
Windows lock primitives: check that we are truly single-threaded Also rustup because why not.
2 parents 1e87c9f + ec95ed4 commit a49234e

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0a675c5e02e6ecfda7d4e04aabd23a9935e0c4bf
1+
ff4df04799c406c8149a041c3163321758aac924

src/shims/foreign_items/windows.rs

+2
Original file line numberDiff line numberDiff line change
@@ -236,12 +236,14 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
236236
| "LeaveCriticalSection"
237237
| "DeleteCriticalSection" if this.frame().instance.to_string().starts_with("std::sys::windows::")
238238
=> {
239+
assert_eq!(this.get_total_thread_count()?, 1, "concurrency on Windows not supported");
239240
// Nothing to do, not even a return value.
240241
// (Windows locks are reentrant, and we have only 1 thread,
241242
// so not doing any futher checks here is at least not incorrect.)
242243
}
243244
"TryEnterCriticalSection" if this.frame().instance.to_string().starts_with("std::sys::windows::")
244245
=> {
246+
assert_eq!(this.get_total_thread_count()?, 1, "concurrency on Windows not supported");
245247
// There is only one thread, so this always succeeds and returns TRUE
246248
this.write_scalar(Scalar::from_i32(1), dest)?;
247249
}
File renamed without changes.

0 commit comments

Comments
 (0)