libobs: Add task scheduling features
(This commit also modifies the UI) Adds the ability to schedule tasks for certain threads
This commit is contained in:
@@ -1327,6 +1327,17 @@ void OBSApp::Exec(VoidFunc func)
|
||||
func();
|
||||
}
|
||||
|
||||
static void ui_task_handler(obs_task_t task, void *param, bool wait)
|
||||
{
|
||||
auto doTask = [=]() {
|
||||
/* to get clang-format to behave */
|
||||
task(param);
|
||||
};
|
||||
QMetaObject::invokeMethod(App(), "Exec",
|
||||
wait ? WaitConnection() : Qt::AutoConnection,
|
||||
Q_ARG(VoidFunc, doTask));
|
||||
}
|
||||
|
||||
bool OBSApp::OBSInit()
|
||||
{
|
||||
ProfileScope("OBSApp::OBSInit");
|
||||
@@ -1338,6 +1349,8 @@ bool OBSApp::OBSInit()
|
||||
if (!StartupOBS(locale.c_str(), GetProfilerNameStore()))
|
||||
return false;
|
||||
|
||||
obs_set_ui_task_handler(ui_task_handler);
|
||||
|
||||
#ifdef _WIN32
|
||||
bool browserHWAccel =
|
||||
config_get_bool(globalConfig, "General", "BrowserHWAccel");
|
||||
|
@@ -2267,6 +2267,9 @@ void OBSBasic::ClearHotkeys()
|
||||
|
||||
OBSBasic::~OBSBasic()
|
||||
{
|
||||
/* clear out UI event queue */
|
||||
QApplication::sendPostedEvents(App());
|
||||
|
||||
if (updateCheckThread && updateCheckThread->isRunning())
|
||||
updateCheckThread->wait();
|
||||
|
||||
|
Reference in New Issue
Block a user