[Audio Threads] Add extra guard to workgroup exit

Add an extra step to the workgroup exit call, so that it only calls to
leave if the join token is valid, or at least initialized.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
Christopher Snowhill 2022-06-17 17:00:59 -07:00
parent 9cc5ba7c0e
commit dad2dbf236

View file

@ -242,7 +242,7 @@ BOOL SetPriorityRealtimeAudio(mach_port_t mach_thread_id) {
- (void)leaveWorkgroup {
if(@available(macOS 11, *)) {
if(wg && !isRealtimeError) {
if(wg && wgToken.sig && !isRealtimeError) {
os_workgroup_leave(wg, &wgToken);
bzero(&wgToken, sizeof(wgToken));
wg = nil;