From 94d002ceb939fe2a821ac24e7ecab4e16c4b4c30 Mon Sep 17 00:00:00 2001 From: Aandreba Date: Tue, 3 Sep 2024 14:33:03 +0200 Subject: [PATCH] fixed readme example --- README.md | 6 +++--- build.zig.zon | 36 ------------------------------------ 2 files changed, 3 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 9fd3e8f..c709186 100644 --- a/README.md +++ b/README.md @@ -67,13 +67,13 @@ test "example" { std.debug.print("Heap align: {}\n\n", .{Arc.innerAlign()}); var value = try Arc.init(std.testing.allocator, .{}); - errdefer value.releaseWithFn(Data.deinit, .{}); + errdefer if (value.releaseUnwrap()) |val| val.deinit(); var handles: [THREADS]Thread = undefined; var i: usize = 0; while (i < THREADS) { const this_value = value.retain(); - errdefer this_value.releaseWithFn(Data.deinit, .{}); + errdefer if (this_value.releaseUnwrap()) |val| val.deinit(); handles[i] = try Thread.spawn(.{}, thread_exec, .{this_value}); i += 1; } @@ -86,7 +86,7 @@ test "example" { } fn thread_exec(data: Arc) !void { - defer data.releaseWithFn(Data.deinit, .{}); + defer if (data.releaseUnwrap()) |val| val.deinit(); var rng = std.rand.DefaultPrng.init(@as(u64, @bitCast(@as(i64, @truncate(std.time.nanoTimestamp()))))); diff --git a/build.zig.zon b/build.zig.zon index 4c0e3f8..a56ca51 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -9,42 +9,6 @@ // with this value. .minimum_zig_version = "0.12.0", - // This field is optional. - // Each dependency must either provide a `url` and `hash`, or a `path`. - // `zig build --fetch` can be used to fetch all dependencies of a package, recursively. - // Once all dependencies are fetched, `zig build` no longer requires - // internet connectivity. - .dependencies = .{ - // See `zig fetch --save ` for a command-line interface for adding dependencies. - //.example = .{ - // // When updating this field to a new URL, be sure to delete the corresponding - // // `hash`, otherwise you are communicating that you expect to find the old hash at - // // the new URL. - // .url = "https://example.com/foo.tar.gz", - // - // // This is computed from the file contents of the directory of files that is - // // obtained after fetching `url` and applying the inclusion rules given by - // // `paths`. - // // - // // This field is the source of truth; packages do not come from a `url`; they - // // come from a `hash`. `url` is just one of many possible mirrors for how to - // // obtain a package matching this `hash`. - // // - // // Uses the [multihash](https://multiformats.io/multihash/) format. - // .hash = "...", - // - // // When this is provided, the package is found in a directory relative to the - // // build root. In this case the package's hash is irrelevant and therefore not - // // computed. This field and `url` are mutually exclusive. - // .path = "foo", - - // // When this is set to `true`, a package is declared to be lazily - // // fetched. This makes the dependency only get fetched if it is - // // actually used. - // .lazy = false, - //}, - }, - // Specifies the set of files and directories that are included in this package. // Only files and directories listed here are included in the `hash` that // is computed for this package.