commit 421fbd939c450b34f310f380466cdc0d3d15133e (tree)
parent 8ec68c63fa1d0f7e267ff92c054e8aa335f91da4
Author: David Rubin <87927264+Rexicon226@users.noreply.github.com>
Date: Tue, 10 Sep 2024 18:04:59 -0700
thread: don't leak the thread in `spawnManager` (#21379)
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/std/Thread/WaitGroup.zig b/lib/std/Thread/WaitGroup.zig
@@ -63,5 +63,6 @@ pub fn spawnManager(
}
};
wg.start();
- _ = std.Thread.spawn(.{}, Manager.run, .{ wg, args }) catch Manager.run(wg, args);
+ const t = std.Thread.spawn(.{}, Manager.run, .{ wg, args }) catch return Manager.run(wg, args);
+ t.detach();
}