Skip to content

Commit ae26f6e

Browse files
committed
Don't pull in a dependency on pthread_kill in single-threaded builds
Fixes a regression preventing single-threaded Emscripten builds from linking successfully without passing `-pthread` to emcc.
1 parent 74d2536 commit ae26f6e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/std/Io/Threaded.zig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -774,9 +774,10 @@ fn await(
774774
result_alignment: std.mem.Alignment,
775775
) void {
776776
_ = result_alignment;
777+
if (builtin.single_threaded) return;
777778
const t: *Threaded = @ptrCast(@alignCast(userdata));
778-
const closure: *AsyncClosure = @ptrCast(@alignCast(any_future));
779-
closure.waitAndFree(t.allocator, result);
779+
const ac: *AsyncClosure = @ptrCast(@alignCast(any_future));
780+
ac.waitAndFree(t.allocator, result);
780781
}
781782

782783
fn cancel(
@@ -786,6 +787,7 @@ fn cancel(
786787
result_alignment: std.mem.Alignment,
787788
) void {
788789
_ = result_alignment;
790+
if (builtin.single_threaded) return;
789791
const t: *Threaded = @ptrCast(@alignCast(userdata));
790792
const ac: *AsyncClosure = @ptrCast(@alignCast(any_future));
791793
ac.closure.requestCancel();

0 commit comments

Comments
 (0)