Hi everyone!
My question is: Is it possible to create nested threads in Qt4?
This is what I exaclly mean:
making an object (lets call it outerObject) that inherits from QThread and has - as one of its members - some other object of other class that also inherits from QThread (lets call it innerObject). Than calling
innerObject.moveToThread(&outerObject)
innerObject.moveToThread(&outerObject)
To copy to clipboard, switch view to plain text mode
to make it live in the thread reprezented by outerObject. Then I start outerObject's thread by calling
outerObject.start();
outerObject.start();
To copy to clipboard, switch view to plain text mode
and also start the thread reprezented by innerObject in similar way. Both of my threads has it's event loops running and there are signals and slots betwen them.
I was trying to find the answer to this question on google and Qt's documentation, but haven't succeeded.
I'm asking this question because I implemented what I described and it generally works (I use currentThreadId(); to watch how it works) but the program breakes down randomly on run. Debugging gives only reference to some Asembler code, so I started to think taht maybe Qt dosen't allowe for one thread inside another.
If any of you have any idea, I'll be very gratfull for sharing your knowladge with me, as orginazing my progrem in that way would make it much easier to implement, that without nested threads.
Thanks in advance!!
Bookmarks