diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2010-10-01 07:50:22 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2010-12-20 15:49:51 (GMT) |
commit | 3b6a84de5c5ed2e1970ad2b396292babb9173227 (patch) | |
tree | 897d4451642314f832f0ebdd3c6d408e446d44e2 /doc/src/snippets/sqldatabase/sqldatabase.pro | |
parent | 8a7b5aca7b6575013a4e4ee9b99808d25edf6fdf (diff) | |
download | Qt-3b6a84de5c5ed2e1970ad2b396292babb9173227.zip Qt-3b6a84de5c5ed2e1970ad2b396292babb9173227.tar.gz Qt-3b6a84de5c5ed2e1970ad2b396292babb9173227.tar.bz2 |
Optimize adaptive spinning mutex code
Change the adaptive spinning code to be elapsed time based instead of
iteration based. The new approach will quickly reduce the amount of
allowed spinning time when it detects that lock contention is resolved
by waiting instead of spinning. We get better results by dynamically
adjusting for elapsed running time instead of trying to fine tune
iteration counts that won't work for all CPU types, speeds, etc.
From observation, lock performance suffers if the spin time is higher
than the minimum wait time. Because of this, QMutex never increases the
spin time, it only reduces the spin time to the minimum observed wait time.
For very long wait times, we disable spinning completely (and always resolve
contention by waiting).
Use QThread::yieldCurrentThread() when spinning on a contended mutex. Comment
from the code: be a good citizen... yielding lets something else run if
there is something to run, but may also relieve memory pressure if not.
Reviewed-by: joao
Diffstat (limited to 'doc/src/snippets/sqldatabase/sqldatabase.pro')
0 files changed, 0 insertions, 0 deletions