mirror of
https://review.haiku-os.org/haiku
synced 2025-02-22 13:38:56 +01:00
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.