Am 28/07/2019 um 06:19 schrieb waddlesplash:
f9c77b11edcf: app_server: Clean up MultiLocker::IsWriteLocked().
This function was (or at least now is) severely over-engineered:
it is designed to avoid calling find_thread(NULL) as little
as possible, and use stack addresses to determine if the current
thread is the one holding the write lock.
However, this is unneccessary, as find_thread(NULL) has been
optimized (on x86 and x86_64, at least) to be a single "mov"
from thread-local data, with no syscall. So that is probably
even faster than an integer divide and compare, allowing
this function to be simplified greatly.
fd97a8c7fe51: app_server: Use a rw_lock instead of 3 (!) semaphores for
MultiLocker.
Since every HWInterface is a MultiLocker, and every BBitmap requires
a server-side BitmapHWInterface, this saves 3 semaphores per BBitmap
instance (as well as a lot of semaphore-related overhead in calling
the kernel so often.)