mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-07-02 00:22:10 -05:00
do not use QThread::create
there might still be versions of QT in use which do not yet have this functionality (see Linux build fail of f03fca8)
This commit is contained in:
parent
f03fca85aa
commit
98c3131017
|
|
@ -1563,7 +1563,7 @@ void SwitcherData::Start()
|
|||
{
|
||||
if (!(th && th->isRunning())) {
|
||||
stop = false;
|
||||
switcher->th = QThread::create([]() { switcher->Thread(); });
|
||||
switcher->th = new SwitcherThread();
|
||||
switcher->th->start((QThread::Priority)switcher->threadPriority);
|
||||
}
|
||||
}
|
||||
|
|
@ -1576,6 +1576,8 @@ void SwitcherData::Stop()
|
|||
transitionCv.notify_one();
|
||||
cv.notify_one();
|
||||
th->wait();
|
||||
delete th;
|
||||
th = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -251,11 +251,14 @@ struct TimeSwitch {
|
|||
|
||||
typedef enum { NO_SWITCH = 0, SWITCH = 1, RANDOM_SWITCH = 2 } NoMatch;
|
||||
|
||||
class SwitcherThread;
|
||||
|
||||
/********************************************************************************
|
||||
* SwitcherData
|
||||
********************************************************************************/
|
||||
struct SwitcherData {
|
||||
QThread* th = nullptr;
|
||||
SwitcherThread *th;
|
||||
|
||||
condition_variable cv;
|
||||
mutex m;
|
||||
bool transitionActive = false;
|
||||
|
|
@ -480,3 +483,10 @@ struct SwitcherData {
|
|||
}
|
||||
inline ~SwitcherData() { Stop(); }
|
||||
};
|
||||
|
||||
extern SwitcherData *switcher;
|
||||
class SwitcherThread : public QThread {
|
||||
public:
|
||||
explicit SwitcherThread(){};
|
||||
void run() { switcher->Thread(); };
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user