PDA

View Full Version : Terminate a QThread with an event loop



paolom
12th May 2010, 10:37
Hi,

I've a main window with a separate thread ( with an event loop ) that copies file in a local disk.

When I close my main window, i destroy the thread, but If the thread is copying a large file I can't stop it !!!

I try with terminate(), quit(), exit(0), ... but the thread has the event loop and since it has complete the copy operation, it doesn't exit.

Is it possible to do ?!?

Thanks

high_flyer
12th May 2010, 11:02
Can you show the relevant code?

Andreas-Duffner
12th May 2010, 11:53
I try with terminate()
Thanks

Did you check this:



Termination can be explicitly enabled or disabled by calling QThread::setTerminationEnabled().

You find it for example here:
http://doc.qt.nokia.com/4.6/qthread.html#terminate