Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QQmlThread Class Reference

#include <qqmlthread_p.h>

+ Inheritance diagram for QQmlThread:
+ Collaboration diagram for QQmlThread:

Public Member Functions

 QQmlThread ()
 
virtual ~QQmlThread ()
 
void startup ()
 
void shutdown ()
 
bool isShutdown () const
 
QMutexmutex ()
 
void lock ()
 
void unlock ()
 
void wakeOne ()
 
void wait ()
 
QThreadthread () const
 
bool isThisThread () const
 
template<typename Method , typename ... Args>
void callMethodInThread (Method &&method, Args &&...args)
 
template<typename Method , typename ... Args>
void callMethodInMain (Method &&method, Args &&...args)
 
template<typename Method , typename ... Args>
void postMethodToThread (Method &&method, Args &&...args)
 
template<typename Method , typename ... Args>
void postMethodToMain (Method &&method, Args &&...args)
 
void waitForNextMessage ()
 
void discardMessages ()
 

Friends

class QQmlThreadPrivate
 

Detailed Description

Definition at line 29 of file qqmlthread_p.h.

Constructor & Destructor Documentation

◆ QQmlThread()

QQmlThread::QQmlThread ( )

Definition at line 171 of file qqmlthread.cpp.

◆ ~QQmlThread()

QQmlThread::~QQmlThread ( )
virtual

Definition at line 176 of file qqmlthread.cpp.

Member Function Documentation

◆ callMethodInMain()

template<typename Method , typename ... Args>
void QQmlThread::callMethodInMain ( Method && method,
Args &&... args )

Definition at line 114 of file qqmlthread_p.h.

References args, and method.

Referenced by QQmlTypeLoaderThread::initializeEngine(), and QQmlTypeLoaderThread::initializeEngine().

+ Here is the caller graph for this function:

◆ callMethodInThread()

template<typename Method , typename ... Args>
void QQmlThread::callMethodInThread ( Method && method,
Args &&... args )

Definition at line 121 of file qqmlthread_p.h.

References args, and method.

Referenced by QQmlTypeLoaderThread::load(), QQmlTypeLoaderThread::loadWithCachedUnit(), and QQmlTypeLoaderThread::loadWithStaticData().

+ Here is the caller graph for this function:

◆ discardMessages()

void QQmlThread::discardMessages ( )
Note
This method must be called in the main thread
Warning
This method requires that the lock is held!

Clear all pending events, for either thread.

Definition at line 402 of file qqmlthread.cpp.

References QFieldList< N, nextMember >::isEmpty(), isThisThread(), QQmlThreadPrivate::mainList, QQmlThreadPrivate::mainSync, Q_ASSERT, QFieldList< N, nextMember >::takeFirst(), and QQmlThreadPrivate::threadList.

Referenced by QQmlTypeLoader::clearCache(), and shutdown().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isShutdown()

bool QQmlThread::isShutdown ( ) const

Definition at line 211 of file qqmlthread.cpp.

References QQmlThreadPrivate::m_shutdown.

◆ isThisThread()

bool QQmlThread::isThisThread ( ) const

Definition at line 241 of file qqmlthread.cpp.

References QThread::currentThreadId(), and QObjectPrivate::get().

Referenced by discardMessages(), doInitializeEngine(), QQmlDataBlob::errors(), QQmlTypeLoader::getType(), and waitForNextMessage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lock()

void QQmlThread::lock ( )

Definition at line 221 of file qqmlthread.cpp.

References QQmlThreadPrivate::lock().

Referenced by waitForNextMessage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutex()

QMutex & QQmlThread::mutex ( )

Definition at line 216 of file qqmlthread.cpp.

References QQmlThreadPrivate::mutex().

+ Here is the call graph for this function:

◆ postMethodToMain()

template<typename Method , typename ... Args>
void QQmlThread::postMethodToMain ( Method && method,
Args &&... args )

Definition at line 135 of file qqmlthread_p.h.

References args, and method.

Referenced by QQmlTypeLoaderThread::callCompleted(), and QQmlTypeLoaderThread::callDownloadProgressChanged().

+ Here is the caller graph for this function:

◆ postMethodToThread()

template<typename Method , typename ... Args>
void QQmlThread::postMethodToThread ( Method && method,
Args &&... args )

Definition at line 128 of file qqmlthread_p.h.

References args, and method.

Referenced by QQmlTypeLoaderThread::loadAsync(), QQmlTypeLoaderThread::loadWithCachedUnitAsync(), and QQmlTypeLoaderThread::loadWithStaticDataAsync().

+ Here is the caller graph for this function:

◆ shutdown()

void QQmlThread::shutdown ( )

Definition at line 191 of file qqmlthread.cpp.

References QCoreApplication::closingDown(), discardMessages(), QQmlThreadPrivate::lock(), QQmlThreadPrivate::m_shutdown, Q_ASSERT, QThread::quit(), QQmlThreadPrivate::triggerThreadEvent(), and QQmlThreadPrivate::unlock().

+ Here is the call graph for this function:

◆ startup()

void QQmlThread::startup ( )

Starts the actual worker thread.

Definition at line 185 of file qqmlthread.cpp.

References QObject::moveToThread(), and QThread::start().

Referenced by QQmlTypeLoaderThread::QQmlTypeLoaderThread().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ thread()

QThread * QQmlThread::thread ( ) const

Definition at line 246 of file qqmlthread.cpp.

◆ unlock()

void QQmlThread::unlock ( )

Definition at line 226 of file qqmlthread.cpp.

References QQmlThreadPrivate::unlock().

Referenced by waitForNextMessage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ wait()

void QQmlThread::wait ( )

Definition at line 236 of file qqmlthread.cpp.

References QQmlThreadPrivate::wait().

+ Here is the call graph for this function:

◆ waitForNextMessage()

void QQmlThread::waitForNextMessage ( )
Note
This method must be called in the main thread
Warning
This method requires that the lock is held!

A call to this method will either:

  • run a message requested to run synchronously on the main thread if there is one (and return afterrwards),
  • wait for the worker thread to notify it if the worker thread has pending work,
  • or simply return if neither of the conditions above hold

Definition at line 369 of file qqmlthread.cpp.

References QFieldList< N, nextMember >::isEmpty(), isThisThread(), lock(), QQmlThreadPrivate::m_mainThreadWaiting, QQmlThreadPrivate::mainSync, Q_ASSERT, QQmlThreadPrivate::threadList, unlock(), QQmlThreadPrivate::wait(), and wakeOne().

Referenced by QQmlTypeLoader::getType().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ wakeOne()

void QQmlThread::wakeOne ( )

Definition at line 231 of file qqmlthread.cpp.

References QQmlThreadPrivate::wakeOne().

Referenced by waitForNextMessage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ QQmlThreadPrivate

friend class QQmlThreadPrivate
friend

Definition at line 70 of file qqmlthread_p.h.


The documentation for this class was generated from the following files: