| ... | ... | @@ -35,8 +35,8 @@ pub fn WaitGroupGeneric(comptime counter_size: u16) type { |
| 35 | 35 | |
| 36 | 36 | const Self = @This(); |
| 37 | 37 | pub fn begin(self: *Self, count: CounterType) error{Overflow}!void { |
| 38 | | const held = self.mutex.acquire(); |
| 39 | | defer held.release(); |
| 38 | self.mutex.lock(); |
| 39 | defer self.mutex.unlock(); |
| 40 | 40 | |
| 41 | 41 | const new_counter = try std.math.add(CounterType, self.counter, count); |
| 42 | 42 | if (new_counter > self.max_counter) return error.Overflow; |
| ... | ... | @@ -45,8 +45,8 @@ pub fn WaitGroupGeneric(comptime counter_size: u16) type { |
| 45 | 45 | |
| 46 | 46 | pub fn finish(self: *Self, count: CounterType) void { |
| 47 | 47 | var waiters = blk: { |
| 48 | | const held = self.mutex.acquire(); |
| 49 | | defer held.release(); |
| 48 | self.mutex.lock(); |
| 49 | defer self.mutex.unlock(); |
| 50 | 50 | self.counter = std.math.sub(CounterType, self.counter, count) catch unreachable; |
| 51 | 51 | if (self.counter == 0) { |
| 52 | 52 | const temp = self.waiters; |
| ... | ... | @@ -65,10 +65,10 @@ pub fn WaitGroupGeneric(comptime counter_size: u16) type { |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | pub fn wait(self: *Self) void { |
| 68 | | const held = self.mutex.acquire(); |
| 68 | self.mutex.lock(); |
| 69 | 69 | |
| 70 | 70 | if (self.counter == 0) { |
| 71 | | held.release(); |
| 71 | self.mutex.unlock(); |
| 72 | 72 | return; |
| 73 | 73 | } |
| 74 | 74 | |
| ... | ... | @@ -83,7 +83,7 @@ pub fn WaitGroupGeneric(comptime counter_size: u16) type { |
| 83 | 83 | self_waiter.next = null; |
| 84 | 84 | } |
| 85 | 85 | suspend { |
| 86 | | held.release(); |
| 86 | self.mutex.unlock(); |
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | }; |