mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 22:18:23 +03:00
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.
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
0a675c5e02e6ecfda7d4e04aabd23a9935e0c4bf
|
||||
ff4df04799c406c8149a041c3163321758aac924
|
||||
|
||||
@@ -236,12 +236,14 @@ fn emulate_foreign_item_by_name(
|
||||
| "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)?;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user