Audio: fix potential exit deadlock
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
36f21d5c4d
commit
194fe8a451
1 changed files with 8 additions and 0 deletions
|
|
@ -245,6 +245,14 @@ fn writeFn(audio_opaque: ?*anyopaque, output: []u8) void {
|
||||||
break :l;
|
break :l;
|
||||||
}
|
}
|
||||||
audio.state().output_mu.unlock();
|
audio.state().output_mu.unlock();
|
||||||
|
|
||||||
|
// Handle potential exit
|
||||||
|
audio.state().running_mu.lock();
|
||||||
|
if (!audio.state().running) {
|
||||||
|
audio.state().running_mu.unlock();
|
||||||
|
@memset(output, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (read_slice.len > output.len) {
|
if (read_slice.len > output.len) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue