diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2012-06-04 21:51:04 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-06 13:27:32 +0200 |
commit | 302e6968f1152d5dee8d5debafb313bd53fa55ff (patch) | |
tree | 983df82f4846fd042efec5979dc0c46d8c85d31c /src/platformsupport/input/evdevtouch | |
parent | fc15a1d5e2cb064df7b6e7b9e821e9db20a91b85 (diff) |
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>
Diffstat (limited to 'src/platformsupport/input/evdevtouch')
0 files changed, 0 insertions, 0 deletions