mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 16:20:06 +00:00
Add thread manager for QThreads
This commit is contained in:
parent
2efdd1b046
commit
8f7076cd09
4 changed files with 126 additions and 0 deletions
37
scwx-qt/source/scwx/qt/manager/thread_manager.hpp
Normal file
37
scwx-qt/source/scwx/qt/manager/thread_manager.hpp
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QObject>
|
||||
#include <QThread>
|
||||
|
||||
namespace scwx
|
||||
{
|
||||
namespace qt
|
||||
{
|
||||
namespace manager
|
||||
{
|
||||
|
||||
class ThreadManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY_MOVE(ThreadManager)
|
||||
|
||||
public:
|
||||
explicit ThreadManager();
|
||||
~ThreadManager();
|
||||
|
||||
QThread* thread(const std::string& id, bool autoStart = true);
|
||||
|
||||
void StopThreads();
|
||||
|
||||
static ThreadManager& Instance();
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
std::unique_ptr<Impl> p;
|
||||
};
|
||||
|
||||
} // namespace manager
|
||||
} // namespace qt
|
||||
} // namespace scwx
|
||||
Loading…
Add table
Add a link
Reference in a new issue