diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2010-09-27 13:19:45 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2010-12-20 15:49:49 (GMT) |
commit | 8a7b5aca7b6575013a4e4ee9b99808d25edf6fdf (patch) | |
tree | 0389aa78b05c7518c8c8ff8b2dab193cc4779390 /doc/src/snippets/sqldatabase/sqldatabase.pro | |
parent | cf17b743d2fe84ab259b7232ab07b58a1872e18e (diff) | |
download | Qt-8a7b5aca7b6575013a4e4ee9b99808d25edf6fdf.zip Qt-8a7b5aca7b6575013a4e4ee9b99808d25edf6fdf.tar.gz Qt-8a7b5aca7b6575013a4e4ee9b99808d25edf6fdf.tar.bz2 |
Improve QMutex contention performance on Linux
Use futex(2) to implement QMutexPrivate::wait() and ::wakeup(). This
makes QMutex perform more or less identically the same as
pthread_mutex_t when contended.
We have to use the contender count in a different way due to the way
that futex() waiting works. Waiting on a futex atomically checks that
the value has not changed from the expected value and then puts the
thread to sleep. So, on Linux, the contender QAtomicInt will only ever
be one of three values: 0 for unlocked, 1 for locked, 2 for contended.
This does mean that there is a slight chance for unfairness due to the
fetch-and-store to zero in the wakeUp() function, but unfortunately this
cannot be avoid as the code is now.
Reviewed-by: joao
Diffstat (limited to 'doc/src/snippets/sqldatabase/sqldatabase.pro')
0 files changed, 0 insertions, 0 deletions