mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
pause hotkey freeze fix (Scene Round Trip/ not done)
This commit is contained in:
parent
b8f94cd1d3
commit
5cff22d758
|
|
@ -26,6 +26,7 @@ void Switcher::switcherThreadFunc() {
|
|||
bool checkFullscreen = false;
|
||||
bool pauseSwitching = false;
|
||||
size_t sleepTime = 1000;
|
||||
auto locked = unique_lock<mutex>(mtx);
|
||||
while (isRunning) {
|
||||
//get Scene Name
|
||||
obs_source_t * transitionUsed = obs_get_output_source(0);
|
||||
|
|
@ -183,7 +184,8 @@ void Switcher::switcherThreadFunc() {
|
|||
}
|
||||
}
|
||||
//sleep for a bit
|
||||
this_thread::sleep_for(chrono::milliseconds(sleepTime));
|
||||
terminate.wait_for(locked, chrono::milliseconds(sleepTime));
|
||||
//this_thread::sleep_for(chrono::milliseconds(sleepTime));
|
||||
sleepTime = 1000;
|
||||
}
|
||||
}
|
||||
|
|
@ -279,6 +281,7 @@ void Switcher::load() {
|
|||
//start thread
|
||||
void Switcher::start()
|
||||
{
|
||||
auto locked = unique_lock<mutex>(mtx);
|
||||
isRunning = true;
|
||||
switcherThread = thread(&Switcher::switcherThreadFunc, this);
|
||||
}
|
||||
|
|
@ -386,6 +389,7 @@ string Switcher::GetActiveWindowTitle()
|
|||
|
||||
//tell the thread to stop
|
||||
void Switcher::stop() {
|
||||
auto locked = unique_lock<mutex>(mtx);
|
||||
isRunning = false;
|
||||
if (switcherThread.joinable()) switcherThread.join();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,4 +29,7 @@ private:
|
|||
bool isWindowFullscreen();
|
||||
string GetActiveWindowTitle();
|
||||
pair<int, int> getCursorXY();
|
||||
bool quit;
|
||||
mutex mtx;
|
||||
condition_variable terminate;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user