using 2 event loops in same thread
-
Hi,
I am using 2 event loops in the main thread and my app is getting crashed. Is it possible to use two event loops in a same thread simultaneously? Is there any problem in using multiple event loops in same thread?Thanks..
-
@rahush Didn't you already asked exact same question before?
Why do you need more than one event loop?
You cannot have more than one event loop running at exact same time - the last one started will block all other. -
Why do you want to have two loops? What is the use case? It sounds like you're doing something wrong.
@BjornW
Thanks @BjornW , I can explain you the use case. There are two instances where I am using event loops.
There is an event loop in the main thread of the application where I am handling the events. Along with this I am sending some metrics to a remote URL(say once every hour), so sending metrics is a background job. I am sending the metrics using QNetworkAccessManager. You can refer this topic for the code: https://forum.qt.io/topic/77972/desktop-app-crashed-when-2-event-loops-are-used .
The event loop used in the topic link above is getting failed. -
Locked, continue in https://forum.qt.io/topic/77972/desktop-app-crashed-when-2-event-loops-are-used please