merlvingian
26th December 2006, 17:28
Is there any simple way to wakeup a thread from QThread::msleep().
Using QTimer as a single shot and putting the thread in a while loop looking for a close and cleanup call seems like more system overhead while QTimer::start() only has an integer resolution and QThread::msleep() has unsigned long being another caveat. I could piggyback QTimers but it would just be more kludged code.
I noticed I can call QThread::terminate but from the docs it does not appear to let me clean up the thread in any way.
Any suggestions on the best way to implement a thread that has a sleep condition and still be able to interrupt and cleanup the thread at any point?
Using QTimer as a single shot and putting the thread in a while loop looking for a close and cleanup call seems like more system overhead while QTimer::start() only has an integer resolution and QThread::msleep() has unsigned long being another caveat. I could piggyback QTimers but it would just be more kludged code.
I noticed I can call QThread::terminate but from the docs it does not appear to let me clean up the thread in any way.
Any suggestions on the best way to implement a thread that has a sleep condition and still be able to interrupt and cleanup the thread at any point?