diff options
Diffstat (limited to 'src/modinfo.h')
| -rw-r--r-- | src/modinfo.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/modinfo.h b/src/modinfo.h index b3e75bc4..d3d13d9c 100644 --- a/src/modinfo.h +++ b/src/modinfo.h @@ -22,6 +22,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "imodinterface.h" #include "versioninfo.h" +#include "envfs.h" class PluginContainer; class QDir; @@ -839,6 +840,36 @@ protected: private: + struct ModThread + { + ModInfo::Ptr ptr; + + std::condition_variable cv; + std::mutex mutex; + bool ready = false; + + void wakeup() + { + { + std::scoped_lock lock(mutex); + ready = true; + } + + cv.notify_one(); + } + + void run() + { + std::unique_lock lock(mutex); + cv.wait(lock, [&] { return ready; }); + + ptr->isValid(); + ready = false; + } + }; + + static env::ThreadPool<ModThread> s_Threads; + static QMutex s_Mutex; static std::map<std::pair<QString, int>, std::vector<unsigned int> > s_ModsByModID; static int s_NextID; |
