From 5e8058566c0070968da99b796acc8dfd514913a5 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Mon, 19 Jun 2023 13:23:22 -0400 Subject: [PATCH] kernel/locks: De-duplicate two inlined methods. The functions declared in locks.h were and are exactly identical to these inline blocks of code. So, rather than duplicate them, just invoke them directly. The compiler will probably inline them anyway. --- src/system/kernel/locks/lock.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/system/kernel/locks/lock.cpp b/src/system/kernel/locks/lock.cpp index c6d5bcdba6..3488fee626 100644 --- a/src/system/kernel/locks/lock.cpp +++ b/src/system/kernel/locks/lock.cpp @@ -240,13 +240,7 @@ recursive_lock_switch_from_read_lock(rw_lock* from, recursive_lock* to) to->holder = thread; #endif } else { -#if KDEBUG_RW_LOCK_DEBUG - _rw_lock_write_unlock(from); -#else - int32 oldCount = atomic_add(&from->count, -1); - if (oldCount >= RW_LOCK_WRITER_COUNT_BASE) - _rw_lock_read_unlock(from); -#endif + rw_lock_read_unlock(from); } to->recursion++; @@ -859,13 +853,7 @@ mutex_switch_from_read_lock(rw_lock* from, mutex* to) InterruptsSpinLocker locker(to->lock); -#if KDEBUG_RW_LOCK_DEBUG - _rw_lock_write_unlock(from); -#else - int32 oldCount = atomic_add(&from->count, -1); - if (oldCount >= RW_LOCK_WRITER_COUNT_BASE) - _rw_lock_read_unlock(from); -#endif + rw_lock_read_unlock(from); return mutex_lock_threads_locked(to, &locker); }