Unsolved run two thread or two code line in same time
-
Hi I have create two thread classes :
1-qprocessThread 2-qprocessThreadTwo
Then in main class I have create two object from above thread classes like below :
qprocessThread mythread; qprocessThreadTwo mythreadtwo;
My question is that, how can run two code line below in the same time or synchronize ?
mythread.initialize(File); mythreadtwo.initialize(File);
I want to both of lines, run or start in the same time. How can I do this???
-
You need to call start() method of both the thread object. There is nothing like both at same time. start() call has to be one after the other from calling/main thread.
-
@Alexanov You should learn how multi-threading works: http://doc.qt.io/qt-5/thread-basics.html
https://mayaposch.wordpress.com/2011/11/01/how-to-really-truly-use-qthreads-the-full-explanation/