qt5base-lts/tests/auto/corelib
Kent Hansen 302e6968f1 statemachine: Make delayed event posting work from secondary thread
postDelayedEvent() and cancelDelayedEvent() are marked as thread-safe
in the documentation. Unfortunately, they didn't actually work when
called from another thread; they just produced some warnings:

QObject::startTimer: timers cannot be started from another thread
QObject::killTimer: timers cannot be stopped from another thread

As the warnings indicate, the issue was that postDelayedEvent()
(cancelDelayedEvent()) unconditionally called QObject::startTimer()
(stopTimer()), i.e. without considering which thread the function
was called from.

If the function is called from a different thread, the actual
starting/stopping of the associated timer is now done from the
correct thread, by asynchronously calling a private slot on the
state machine.

This also means that the raw timer id can no longer be used as the
id of the delayed event, since a valid event id must be returned
before the timer has started. The state machine now manages those
ids itself (using a QFreeList, just like startTimer() and
killTimer() do), and also keeps a mapping from timer id to event
id once the timer has been started. This is inherently more complex
than before, but at least the API should work as advertised/intended
now.

Task-number: QTBUG-17975
Change-Id: I3a866d01dca23174c8841112af50b87141df0943
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
2012-06-06 13:27:32 +02:00
..
animation Add CONFIG+=parallel_test to suspected parallel-safe tests. 2012-05-28 07:33:01 +02:00
codecs Add CONFIG+=parallel_test to suspected parallel-safe tests. 2012-05-28 07:33:01 +02:00
global Add Q_UINT64_C to 64 bit integer literal. 2012-05-15 23:03:23 +02:00
io Fix QTemporaryFile::open() failing after remove(). 2012-06-05 06:15:06 +02:00
itemmodels Add CONFIG+=parallel_test to suspected parallel-safe tests. 2012-05-28 07:33:01 +02:00
json Fixed QJsonObject::find() 2012-06-06 02:03:11 +02:00
kernel Add private API for working with meta-methods in signal index range 2012-06-01 16:04:04 +02:00
mimetypes Removed CONFIG+=parallel_test from suspected parallel-unsafe tests [2] 2012-05-23 03:17:59 +02:00
plugin Add CONFIG+=parallel_test to suspected parallel-safe tests. 2012-05-28 07:33:01 +02:00
statemachine statemachine: Make delayed event posting work from secondary thread 2012-06-06 13:27:32 +02:00
thread Use QPointer instead of QWeakPointer. 2012-06-05 18:42:26 +02:00
tools Make QString("inf").toFloat() return inf instead of zero. 2012-06-05 06:14:57 +02:00
xml Add CONFIG+=parallel_test to suspected parallel-safe tests. 2012-05-28 07:33:01 +02:00
corelib.pro Import QMimeType / QMimeDatabase into QtCore. 2012-02-18 22:19:43 +01:00