mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-09-07 09:05:57 -05:00
add thread priority option (using QThread)
This commit is contained in:
@@ -130,6 +130,7 @@ public slots:
|
||||
|
||||
void on_priorityUp_clicked();
|
||||
void on_priorityDown_clicked();
|
||||
void on_threadPriority_currentTextChanged(const QString &text);
|
||||
|
||||
void updateScreenRegionCursorPos();
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include <chrono>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <thread>
|
||||
#include <regex>
|
||||
#include <mutex>
|
||||
#include <fstream>
|
||||
@@ -256,7 +255,7 @@ typedef enum { NO_SWITCH = 0, SWITCH = 1, RANDOM_SWITCH = 2 } NoMatch;
|
||||
* SwitcherData
|
||||
********************************************************************************/
|
||||
struct SwitcherData {
|
||||
thread th;
|
||||
QThread* th = nullptr;
|
||||
condition_variable cv;
|
||||
mutex m;
|
||||
bool transitionActive = false;
|
||||
@@ -311,18 +310,33 @@ struct SwitcherData {
|
||||
DEFAULT_PRIORITY_3, DEFAULT_PRIORITY_4, DEFAULT_PRIORITY_5,
|
||||
DEFAULT_PRIORITY_6, DEFAULT_PRIORITY_7};
|
||||
|
||||
std::vector<std::string> threadPrioritiesNamesOrderdByPrio{
|
||||
"Lowest", "Low", "Normal", "High", "Highest", "Time critical",
|
||||
struct ThreadPrio {
|
||||
std::string name;
|
||||
std::string description;
|
||||
uint32_t value;
|
||||
};
|
||||
std::map<std::string, int> threadPriorities = {
|
||||
{"Lowest", QThread::LowestPriority},
|
||||
{"Low", QThread::LowPriority},
|
||||
{"Normal", QThread::NormalPriority},
|
||||
{"High", QThread::HighPriority},
|
||||
{"Highest", QThread::HighestPriority},
|
||||
{"Time critical", QThread::TimeCriticalPriority},
|
||||
|
||||
std::vector<ThreadPrio> threadPriorities{
|
||||
{"Idle",
|
||||
"scheduled only when no other threads are running (lowest CPU load)",
|
||||
QThread::IdlePriority},
|
||||
{"Lowest", "scheduled less often than LowPriority",
|
||||
QThread::LowestPriority},
|
||||
{"Low", "scheduled less often than NormalPriority",
|
||||
QThread::LowPriority},
|
||||
{"Normal", "the default priority of the operating system",
|
||||
QThread::NormalPriority},
|
||||
{"High", "scheduled more often than NormalPriority",
|
||||
QThread::HighPriority},
|
||||
{"Highest", "scheduled more often than HighPriority",
|
||||
QThread::HighestPriority},
|
||||
{"Time critical",
|
||||
"scheduled as often as possible (highest CPU load)",
|
||||
QThread::TimeCriticalPriority},
|
||||
};
|
||||
|
||||
uint32_t threadPriority = QThread::NormalPriority;
|
||||
|
||||
void Thread();
|
||||
void Start();
|
||||
void Stop();
|
||||
|
||||
Reference in New Issue
Block a user