/*!
Returns true if the thread is finished; otherwise returns false.
\sa isRunning()
*/
bool QThread::isFinished() const
{
Q_D(const QThread);
QMutexLocker locker(&d->mutex);
return d->finished;
}
/*!
Returns true if the thread is running; otherwise returns false.
\sa isFinished()
*/
bool QThread::isRunning() const
{
Q_D(const QThread);
QMutexLocker locker(&d->mutex);
#ifdef Q_OS_SYMBIAN
// app shutdown on Symbian can terminate threads and invalidate their stacks without notification,
// check the thread is still alive.
if (d->data->symbian_thread_handle.Handle() && d->data->symbian_thread_handle.ExitType() != EExitPending)
return false;
#endif
return d->running;
}
都在源码里边了,可以理解为QThread里边有俩成员变量(非直接成员,使用d指针包装了),一个是bool running,一个是bool finished;其中running在start时置为true,finished置为false,,线程结束时类似处理...