Go to file
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
bin make syncqt work with MSys Perl and MSVC 2012-06-01 18:26:18 +02:00
config.tests configure: Auto-detect and enable C++11 support if available 2012-06-05 12:30:13 +02:00
dist configure: Auto-detect and enable C++11 support if available 2012-06-05 12:30:13 +02:00
doc Remove the MacMainWindow example. 2012-05-30 01:54:45 +02:00
examples Remove useless "QT += widgets" 2012-06-05 16:01:29 +02:00
lib Initial import from the monolithic Qt. 2011-04-27 12:05:43 +02:00
mkspecs Generalize common device properties out of Raspberry Pi spec 2012-06-06 02:02:40 +02:00
qmake qmake can not process project file with UTF-8 BOM 2012-05-30 01:54:45 +02:00
src statemachine: Make delayed event posting work from secondary thread 2012-06-06 13:27:32 +02:00
tests statemachine: Make delayed event posting work from secondary thread 2012-06-06 13:27:32 +02:00
tools Move the sub-architecture feature to better places in qmake 2012-05-31 17:55:49 +02:00
util Move ScriptSentinel enum from header to .cpp 2012-05-25 21:48:44 +02:00
.gitattributes Added .tag file with Git revision. 2011-05-03 16:23:49 +02:00
.gitignore Add imports directory to ignore list 2012-04-11 01:42:12 +02:00
.tag Added .tag file with Git revision. 2011-05-03 16:23:49 +02:00
configure Do not build eglfs QPA when cross compiling for QNX 2012-06-06 12:31:58 +02:00
configure.bat Remove Q_BYTE_ORDER and -*-endian arguments from configures 2012-03-02 14:48:00 +01:00
header.BSD Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
header.FDL Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
header.LGPL Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
header.LGPL-ONLY Remove "All rights reserved" line from license headers. 2012-01-30 03:54:59 +01:00
INSTALL Remove Symbian specific code from qtbase. 2012-01-31 07:08:31 +01:00
LGPL_EXCEPTION.txt Initial import from the monolithic Qt. 2011-04-27 12:05:43 +02:00
LICENSE.FDL Initial import from the monolithic Qt. 2011-04-27 12:05:43 +02:00
LICENSE.GPL Add the LICENSE.GPL file to the module referenced from license headers 2012-05-20 22:41:08 +02:00
LICENSE.LGPL Update contact information in license headers. 2012-01-23 04:04:33 +01:00
LICENSE.PREVIEW.COMMERCIAL Initial import from the monolithic Qt. 2011-04-27 12:05:43 +02:00
qtbase.pro Remove all references to X11 session management 2012-06-01 03:15:55 +02:00
sync.profile Expose QPA API under qpa/* 2012-05-07 20:25:24 +02:00