Fix counting in SingleThreadedRwLock's tryLockShared (#16560)
Additionally we add RwLock to Thread.zig's list of tests
This commit is contained in:
@@ -1438,6 +1438,7 @@ test {
|
||||
_ = Mutex;
|
||||
_ = Semaphore;
|
||||
_ = Condition;
|
||||
_ = RwLock;
|
||||
}
|
||||
|
||||
fn testIncrementNotify(value: *usize, event: *ResetEvent) void {
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user