Fix counting in SingleThreadedRwLock's tryLockShared (#16560)

Additionally we add RwLock to Thread.zig's list of tests
This commit is contained in:
Jim Price 2023-07-26 06:19:52 -07:00 committed by GitHub
parent a8a2f2b58b
commit 584b062a30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -1438,6 +1438,7 @@ test {
_ = Mutex;
_ = Semaphore;
_ = Condition;
_ = RwLock;
}
fn testIncrementNotify(value: *usize, event: *ResetEvent) void {

View File

@ -95,7 +95,11 @@ pub const SingleThreadedRwLock = struct {
rwl.shared_count = 1;
return true;
},
.locked_exclusive, .locked_shared => return false,
.locked_shared => {
rwl.shared_count += 1;
return true;
},
.locked_exclusive => return false,
}
}