diff --git a/DisplaySettings/DisplaySettings.cpp b/DisplaySettings/DisplaySettings.cpp index c6c3cff104..ff9395c505 100644 --- a/DisplaySettings/DisplaySettings.cpp +++ b/DisplaySettings/DisplaySettings.cpp @@ -3795,6 +3795,11 @@ namespace WPEFramework { return m_powerState; } + void DisplaySettings::initAudioPortsWorker(void) + { + DisplaySettings::_instance->InitAudioPorts(); + } + void DisplaySettings::powerEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len) { if(!DisplaySettings::_instance) @@ -3810,7 +3815,20 @@ namespace WPEFramework { eventData->data.state.curState, eventData->data.state.newState); m_powerState = eventData->data.state.newState; if (eventData->data.state.newState == IARM_BUS_PWRMGR_POWERSTATE_ON) { - DisplaySettings::_instance->InitAudioPorts(); + try + { + LOGWARN("creating worker thread for initAudioPortsWorker "); + std::thread audioPortInitThread = std::thread(initAudioPortsWorker); + audioPortInitThread.detach(); + } + catch(const std::system_error& e) + { + LOGERR("system_error exception in thread creation: %s", e.what()); + } + catch(const std::exception& e) + { + LOGERR("exception in thread creation : %s", e.what()); + } } else { diff --git a/DisplaySettings/DisplaySettings.h b/DisplaySettings/DisplaySettings.h index 2621c8295b..4a90b576b8 100644 --- a/DisplaySettings/DisplaySettings.h +++ b/DisplaySettings/DisplaySettings.h @@ -141,6 +141,7 @@ namespace WPEFramework { uint32_t setMS12ProfileSettingsOverride(const JsonObject& parameters, JsonObject& response); void InitAudioPorts(); void AudioPortsReInitialize(); + static void initAudioPortsWorker(void); //End methods //Begin events