diff --git a/cocos/audio/apple/AudioEngine-inl.mm b/cocos/audio/apple/AudioEngine-inl.mm index 06c9992d2e..7532654f90 100644 --- a/cocos/audio/apple/AudioEngine-inl.mm +++ b/cocos/audio/apple/AudioEngine-inl.mm @@ -215,6 +215,7 @@ ALvoid AudioEngineImpl::myAlSourceNotificationCallback(ALuint sid, ALuint notifi return; AudioPlayer* player = nullptr; + s_instance->_threadMutex.lock(); for (const auto& e : s_instance->_audioPlayers) { player = e.second; @@ -223,6 +224,7 @@ ALvoid AudioEngineImpl::myAlSourceNotificationCallback(ALuint sid, ALuint notifi player->wakeupRotateThread(); } } + s_instance->_threadMutex.unlock(); } AudioEngineImpl::AudioEngineImpl()