Function join [src]
Waits for the thread to complete, then deallocates any resources created on spawn().
Once called, this consumes the Thread object and invoking any other functions on it is considered undefined behavior.
Prototype
pub fn join(self: Thread) void
Parameters
self: Thread
Example
test join {
if (builtin.single_threaded) return error.SkipZigTest;
var value: usize = 0;
var event = ResetEvent{};
const thread = try Thread.spawn(.{}, testIncrementNotify, .{ &value, &event });
thread.join();
try std.testing.expectEqual(value, 1);
}
Source
pub fn join(self: Thread) void {
return self.impl.join();
}