mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-20 08:15:46 -05:00
@@ -1569,7 +1569,7 @@ void SwitcherData::Start()
|
||||
{
|
||||
if (!(th && th->isRunning())) {
|
||||
stop = false;
|
||||
switcher->th = new SwitcherThread();
|
||||
switcher->th = QThread::create([]() { switcher->Thread(); });
|
||||
switcher->th->start((QThread::Priority)switcher->threadPriority);
|
||||
}
|
||||
}
|
||||
@@ -1582,8 +1582,6 @@ void SwitcherData::Stop()
|
||||
transitionCv.notify_one();
|
||||
cv.notify_one();
|
||||
th->wait();
|
||||
delete th;
|
||||
th = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -253,14 +253,11 @@ struct TimeSwitch {
|
||||
|
||||
typedef enum { NO_SWITCH = 0, SWITCH = 1, RANDOM_SWITCH = 2 } NoMatch;
|
||||
|
||||
class SwitcherThread;
|
||||
|
||||
/********************************************************************************
|
||||
* SwitcherData
|
||||
********************************************************************************/
|
||||
struct SwitcherData {
|
||||
SwitcherThread *th;
|
||||
|
||||
QThread* th = nullptr;
|
||||
condition_variable cv;
|
||||
mutex m;
|
||||
bool transitionActive = false;
|
||||
@@ -485,10 +482,3 @@ struct SwitcherData {
|
||||
}
|
||||
inline ~SwitcherData() { Stop(); }
|
||||
};
|
||||
|
||||
extern SwitcherData *switcher;
|
||||
class SwitcherThread : public QThread {
|
||||
public:
|
||||
explicit SwitcherThread(){};
|
||||
void run() { switcher->Thread(); };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user