diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2017-08-26 00:38:51 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2017-10-23 05:09:22 +0000 |
commit | 895cb4681ee78caaf9b99c88390a74ff1d79ae61 (patch) | |
tree | 2adf788ad4f97ae3fe4e1e567457bbd999e66b15 /src/network/kernel/qnetworkproxy.cpp | |
parent | bf15e22cee235b31f43032e7b9862926a92fa75c (diff) | |
download | qtbase-895cb4681ee78caaf9b99c88390a74ff1d79ae61.tar.gz |
QSemaphore: Improve waking up on 64-bit Linux
By judiciously positioning of the bits, we can optimize for the case of
threads trying to acquire a single token, which is what QSemaphore
should be mostly used for, as it matches the POSIX Semaphore API
(sem_wait, sem_timedwait and sem_trywait). If there are only waiters
waiting for a single token, we know that adding n tokens means n threads
can wake up.
This optimizes for multi-token waiters too. For example, if we have 50
single-token waiters and 50 multi-token waiters, a sem.release(5) will
wake up 55 threads instead of 100.
Change-Id: I209fcd5dbc2b4e5381cffffd14de5550c75d2600
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/network/kernel/qnetworkproxy.cpp')
0 files changed, 0 insertions, 0 deletions