[Qt-interest] QThread run() method
Srdjan Todorovic
todorovic.s at googlemail.com
Wed Sep 16 15:10:10 CEST 2009
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
More information about the Qt-interest-old
mailing list