Unsolved How to force the run() function to execute first
-
Hi ,
I have below code where I see that the run function of the clientThread runs after the serverConnect() function. How can I force the run() function to execute first before serverConnect.Thank you,
clientThread->start(); /* Connect to the notification server. */ clientThread->serverConnect();
-
This should work:
QTimer::singleShot(0, []() { clientThread->serverConnect() } );
Or, if serverConnect() is a slot:
QTimer::singleShot(0, clientThread, &ClientThread::serverConnect());
-
I used the started SIGNAL and called serverConnect in SLOT function.