how to separating g_main_loop from qt gui thread
-
how to separating g_main_loop from qt gui thread.
I executed g_main_loop in a separate Thread as below.
However, signal events in GLib(dbus) are always received as GUI Main Thread.please tell me.. How do I separate g_main_loop from qt gui thread?
void HmiAppInit() { ... m_mainLoopThread = std::thread([&]() { m_mainLoop = g_main_loop_new(nullptr, FALSE); g_main_loop_run(m_mainLoop); }); ... } int main(int argc, char **argv) { QGuiApplication app(argc, argv); HmiAppInit(); return app.exec(); }
-
Hi,
Can you explain why you want to use the GLib loop ?
-
Hi ,
thank you for your reply.
I use GDBus for communication between different apps.
(GDBus handles signal events in g_main_loop.)However, if there are many touch and dbus events in the GUI Thread, it will hang.
Also, "The Wayland connection broke. Did the Wayland compositor die?" is printed and the app is terminated.
Therefore, I try to process GUIThread and GDBus events with different Threads. -
how to separating g_main_loop from qt gui thread.
I executed g_main_loop in a separate Thread as below.
However, signal events in GLib(dbus) are always received as GUI Main Thread.please tell me.. How do I separate g_main_loop from qt gui thread?
void HmiAppInit() { ... m_mainLoopThread = std::thread([&]() { m_mainLoop = g_main_loop_new(nullptr, FALSE); g_main_loop_run(m_mainLoop); }); ... } int main(int argc, char **argv) { QGuiApplication app(argc, argv); HmiAppInit(); return app.exec(); }
This post is deleted! -
Qt being asynchronous, why do you need to handle the DBus messages in another thread ?
-
@SGaist
if there are many touch and dbus events in the GUI Thread, it will delays or hangs.
Also, "The Wayland connection broke. Did the Wayland compositor die?" is printed and the app is terminated.
Therefore, I try to process GUIThread and GDBus events with different Threads. -
Did you benchmark QtDBus with your GUI to see if you have that issue ?