zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit db96ad4a16a2251c5b0ed07a25a8a617e2399d9d (tree)
parent 844da16d8e67ad97c4eb8b2251734d69cb018cae
Author: GethDW <gethwilliams@googlemail.com>
Date:   Fri, 19 Apr 2024 16:10:58 +0100

std: fix Thread.Pool.spawn

`@alignCast` was required for args with greater alignment than that of a pointer.

Diffstat:
Mlib/std/Thread/Pool.zig | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/std/Thread/Pool.zig b/lib/std/Thread/Pool.zig @@ -89,7 +89,7 @@ pub fn spawn(pool: *Pool, comptime func: anytype, args: anytype) !void { fn runFn(runnable: *Runnable) void { const run_node: *RunQueue.Node = @fieldParentPtr("data", runnable); - const closure: *@This() = @fieldParentPtr("run_node", run_node); + const closure: *@This() = @alignCast(@fieldParentPtr("run_node", run_node)); @call(.auto, func, closure.arguments); // The thread pool's allocator is protected by the mutex.