audio: make applicationState() thread-safe

Closes #3021
This commit is contained in:
Hajime Hoshi 2024-07-06 17:37:37 +09:00
parent 4997e7e254
commit 9ef27a2c75

View File

@ -20,12 +20,15 @@ package audio
// #import <UIKit/UIKit.h>
//
// static UIApplicationState applicationState() {
// // Actually this method should be called on the main thread,
// // but there is no way to do that in the current Ebitengine implementation.
// // dispatch_(a)sync causes a deadlock.
// // As this is for an invetigation of iOS errors, that's OK to leave this issue so far.
// if ([NSThread isMainThread]) {
// return [[UIApplication sharedApplication] applicationState];
// }
// __block UIApplicationState state;
// dispatch_sync(dispatch_get_main_queue(), ^{
// state = [[UIApplication sharedApplication] applicationState];
// });
// return state;
// }
import "C"
import (