diff options
author | Lars Knoll <lars.knoll@qt.io> | 2019-01-09 22:23:23 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2019-03-29 13:46:39 +0000 |
commit | 993b049adfa9aaa22324761ce41fe2569184079a (patch) | |
tree | d2bcb3a3ff8136b2b275c06f22a50699aa6f7bb2 /src/corelib/kernel/qmetaobject_moc_p.h | |
parent | 13ab090977439cf432c7b99dbdd2b1263b4d8cd4 (diff) |
Get rid of the locking in activate()
Removing connections and resizing the signal vector now
happens in a way that will not interfere with activate(),
as the old objects won't get deleted if we are somewhere
inside a signal emission.
This means that we don't need to lock the senders mutex
in activate anymore, as long as the reference counting
on the ConnectionData is atomic and we are in the senders
thread.
This implies that we now need to lock the receivers mutex in
queued_activate() abd blocking queued activation to ensure
it hasn't been deleted while we are emitting.
In addition, some precautions need to be taken to not read
from the receiver without holding the lock, as it could get
deleted while we're activating (if it's in a different thread).
To make that possible store the receivers thread id in the
connection data.
Use atomic pointers for all variables that can get modified
with the signalSlotLock() held and that are being read
without the lock being held.
This gives us a very nice additional speed improvement
for signal emissions.
without change with change
string based connect: 3287 2436
pointer based connect: 3941 3265
not connected: 403 400
disconnected: 460 489
5 slots connected: 9112 4515
Change-Id: Ib7324bb74c389dcc3b6581a03c31469a6e589fc2
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/kernel/qmetaobject_moc_p.h')
0 files changed, 0 insertions, 0 deletions