| 152 | } |
| 153 | |
| 154 | void CEventSystem::StartEventSystem() |
| 155 | { |
| 156 | // Preserve the Python sub-interpreter across restarts to avoid the |
| 157 | // Py_EndInterpreter / Py_NewInterpreter cycle that crashes on Python 3.13. |
| 158 | StopEventSystem(false); |
| 159 | m_mainworker.m_notificationsystem.Register(this); |
| 160 | |
| 161 | if (!m_bEnabled) |
| 162 | return; |
| 163 | |
| 164 | RequestStart(); |
| 165 | m_TaskQueue.RequestStart(); |
| 166 | |
| 167 | m_sql.GetPreferencesVar("SecStatus", m_SecStatus); |
| 168 | |
| 169 | LoadEvents(); |
| 170 | GetCurrentStates(); |
| 171 | GetCurrentScenesGroups(); |
| 172 | GetCurrentUserVariables(); |
| 173 | #ifdef ENABLE_PYTHON |
| 174 | Plugins::PythonEventsInitialize(szUserDataFolder); |
| 175 | #endif |
| 176 | |
| 177 | m_thread = std::make_shared<std::thread>([this] { Do_Work(); }); |
| 178 | SetThreadName(m_thread->native_handle(), "EventSystem"); |
| 179 | m_eventqueuethread = std::make_shared<std::thread>([this] { EventQueueThread(); }); |
| 180 | SetThreadName(m_eventqueuethread->native_handle(), "EventSystemQueue"); |
| 181 | m_szStartTime = TimeToString(&m_StartTime, TF_DateTime); |
| 182 | } |
| 183 | |
| 184 | void CEventSystem::StopEventSystem(bool bDestroyPythonInterpreter /*= true*/) |
| 185 | { |
no test coverage detected