#ifndef OPENMW_MWLUA_WORKER_H #define OPENMW_MWLUA_WORKER_H #include #include #include #include namespace osgViewer { class Viewer; } namespace MWLua { class LuaManager; class Worker { public: explicit Worker(LuaManager& manager, osgViewer::Viewer& viewer); ~Worker(); void allowUpdate(); void finishUpdate(); void join(); private: void update(); void run() noexcept; LuaManager& mManager; osgViewer::Viewer& mViewer; std::mutex mMutex; std::condition_variable mCV; bool mUpdateRequest = false; bool mJoinRequest = false; std::optional mThread; }; } #endif // OPENMW_MWLUA_LUAWORKER_H