diff options
author | Sze Howe Koh <szehowe.koh@gmail.com> | 2013-10-02 22:31:05 +0800 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-06 01:08:11 +0200 |
commit | a15bc0e714539c3dca8476254780e645bbbe1a12 (patch) | |
tree | b5aac8a34539e2036e696633c36a200d80bbaa48 /src/corelib/doc/src/threads-basics.qdoc | |
parent | 525712b75e4f7a49a09b5e3d88b6000d722a33d7 (diff) |
Doc: Show both low- and high-level thread syncing on the same page
Move text from "Thread Basics" to "Synchronizing Threads" for a more
complete overview.
Change-Id: Ib87259ed551fa77278b57c5922df7f4b774a829a
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Diffstat (limited to 'src/corelib/doc/src/threads-basics.qdoc')
-rw-r--r-- | src/corelib/doc/src/threads-basics.qdoc | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/src/corelib/doc/src/threads-basics.qdoc b/src/corelib/doc/src/threads-basics.qdoc index 9cf93d40fd..5d6e0f6ef1 100644 --- a/src/corelib/doc/src/threads-basics.qdoc +++ b/src/corelib/doc/src/threads-basics.qdoc @@ -275,29 +275,6 @@ operation. One disadvantage is that external mutexes aid locking, but do not enforce it because users of the object may forget to use it. - \section2 Using the Event Loop to Prevent Data Corruption - - Qt's \l{The Event System}{event system} is very useful for inter-thread - communication. Every thread may have its own event loop. To call a slot (or - any \l{Q_INVOKABLE}{invokable} method) in another thread, place that call in - the target thread's event loop. This lets the target thread finish its current - task before the slot starts running, while the original thread continues - running in parallel. - - To place an invocation in an event loop, make a queued \l{Signals & Slots} - {signal-slot} connection. Whenever the signal is emitted, its arguments will - be recorded by the event system. The thread that the signal receiver - \l{QObject#Thread Affinity}{lives in} will then run the slot. Alternatively, - call QMetaObject::invokeMethod() to achieve the same effect without signals. - In both cases, a \l{Qt::QueuedConnection}{queued connection} must be used - because a \l{Qt::DirectConnection}{direct connection} bypasses the event - system and runs the method immediately in the current thread. - - There is no risk of deadlocks when using the event system for thread - synchronization, unlike using low-level primitives. - - \sa QThread::exec(), {Threads and QObjects} - \section2 Dealing with Asynchronous Execution One way to obtain a worker thread's result is by waiting for the thread |