Skip to content

Commit

Permalink
std: fix Thread.Pool.spawn
Browse files Browse the repository at this point in the history
`@alignCast` was required for args with greater alignment than that of a pointer.
  • Loading branch information
GethDW authored and andrewrk committed Apr 19, 2024
1 parent 844da16 commit db96ad4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/std/Thread/Pool.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit db96ad4

Please sign in to comment.