We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fb27476 commit 4b0caecCopy full SHA for 4b0caec
1 file changed
library/std/src/sys/sync/rwlock/no_threads.rs
@@ -17,6 +17,10 @@ impl RwLock {
17
#[inline]
18
pub fn read(&self) {
19
let m = self.mode.get();
20
+
21
+ // Check for overflow.
22
+ assert!(m == isize::MAX, "too many active read locks on RwLock");
23
24
if m >= 0 {
25
self.mode.set(m + 1);
26
} else {
@@ -28,6 +32,9 @@ impl RwLock {
28
32
pub fn try_read(&self) -> bool {
29
33
30
34
35
+ if m == isize::MAX {
36
+ return false;
37
+ }
31
38
39
true
40
0 commit comments