std: fix Thread.Pool.spawn

`@alignCast` was required for args with greater alignment than that of a pointer.
This commit is contained in:
GethDW 2024-04-19 16:10:58 +01:00 committed by Andrew Kelley
parent 844da16d8e
commit db96ad4a16

View File

@ -89,7 +89,7 @@ pub fn spawn(pool: *Pool, comptime func: anytype, args: anytype) !void {
fn runFn(runnable: *Runnable) void { fn runFn(runnable: *Runnable) void {
const run_node: *RunQueue.Node = @fieldParentPtr("data", runnable); 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); @call(.auto, func, closure.arguments);
// The thread pool's allocator is protected by the mutex. // The thread pool's allocator is protected by the mutex.