Skip to content

Commit

Permalink
remove: @Fence()
Browse files Browse the repository at this point in the history
  • Loading branch information
RonaldZielaznicki authored and emidoots committed Oct 16, 2024
1 parent aa8ff90 commit 85a90dd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/sysgpu/utils.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ const sysgpu = @import("sysgpu/main.zig");

pub fn Manager(comptime T: type) type {
return struct {
count: u32 = 1,
count: std.atomic.Value(u32) = std.atomic.Value(u32).init(1),

pub fn reference(manager: *@This()) void {
_ = @atomicRmw(u32, &manager.count, .Add, 1, .monotonic);
_ = manager.count.fetchAdd(1, .monotonic);
}

pub fn release(manager: *@This()) void {
if (@atomicRmw(u32, &manager.count, .Sub, 1, .release) == 1) {
@fence(.acquire);
if (manager.count.fetchSub(1, .release) == 1) {
_ = manager.count.load(.acquire);
const parent: *T = @alignCast(@fieldParentPtr("manager", manager));
parent.deinit();
}
Expand Down

0 comments on commit 85a90dd

Please sign in to comment.