mirror of
https://github.com/ziglang/zig.git
synced 2026-01-21 06:45:24 +00:00
Fix counting in SingleThreadedRwLock's tryLockShared (#16560)
Additionally we add RwLock to Thread.zig's list of tests
This commit is contained in:
parent
a8a2f2b58b
commit
584b062a30
@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user