1.int loopLevel() const;
int QThread::loopLevel() const
{
Q_D(const QThread);
return d->data->eventLoops.size();
}
返回当前线程的looplevel. QThread::exec()会增加looplevel计数。
QThread::Priority QThread::priority() const
{
Q_D(const QThread);
QMutexLocker locker(&d->mutex);
// mask off the high bits that are used for flags
return Priority(d->priority & 0xffff);
}
返回线程

这篇博客深入探讨了QThread类的关键功能,包括获取线程的循环级别(loopLevel)、设置和获取线程优先级(priority)、请求线程中断(requestInterruption)以及线程的执行(run)和事件调度。QThread::exec()会增加线程的循环级别,requestInterruption()则是建议性地请求中断线程,而run()通常调用exec()开始线程执行。此外,还介绍了设置事件分派器(setEventDispatcher)的方法,用于自定义线程的事件处理方式。
最低0.47元/天 解锁文章
371

被折叠的 条评论
为什么被折叠?



