Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

Deadlock - Creating a QThread from the main thread

$
0
0
I am trying to debug a situation where 2 threads have been locked on the same mutex(QMutex). The connection between the two threads is -one thread is created from another. i.e. First is the main thread( gui thread) , from which i create a another object of an user defined class. From the constructor of this object a new thread is created. Is it a wrong usage ? //Some part of Code:   void main() {   MyMainThread *obj = new MyMainThread(); // this class inherits QWidget }   //This class declaration is in another file class Someobj {   SomeObj()   {   }   StartAnotherObjThread()   {      AnotherObjthread obj = new AnotherObjThread(this);      obj->start();         } }   MyMainThread() {   SomeObj *obj = new SomeObj();   obj->StartAnotherObjThread(); }

Viewing all articles
Browse latest Browse all 18427

Trending Articles