[Qt-interest] QThread run() method
Mike Jackson
imikejackson at gmail.com
Fri Oct 2 22:06:16 CEST 2009
On 2009-09-16 09:10:10 -0400, Srdjan Todorovic
<todorovic.s at googlemail.com> said:
> Hi all,
>
> On 31/08/2009, Jeroen De Wachter <> wrote:
>> One might suggest exiting the thread cleanly and just calling exit() or
>> quit() from within the thread instead of terminating it (while it may
>> hold a mutex, be in the middle of modifying data or anything else of the
>> sort)
>
> Quite some time ago (Qt 4.0/4.1) I created a QThread with its own
> event loop. The idea was that, to quit the thread, some other object
> would emit a signal to the thread with the event loop. This signal
> would hit a slot in the thread that would do the cleanup of the thread
> object and cause the event loop to exit. Once that happened, the run()
> method would finish and the thread would be done. One can then delete
> it later on - I don't remember if I deleted it in a special way.
>
> Regards,
> Srdjan
Could you post exactly how you did this? I am having some problems
sending signals from the main thread to a grand-child thread via
Signals/Slots.
My own thread class subclasses QThread and implements "void run();". I
can not quite figure out how to get the even loop started. If I call
"exec()" then that will block (or seems to in my code.
Thanks
MIke Jackson
More information about the Qt-interest-old
mailing list