summaryrefslogtreecommitdiff
path: root/Kernel/Locking/Mutex.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-08-23 02:17:02 +0200
committerAndreas Kling <kling@serenityos.org>2021-08-23 02:17:02 +0200
commita8967388d3b6986dd10fab193c0b1fef287a4e18 (patch)
tree7baba2cd9d66de777348110596a200370ab20194 /Kernel/Locking/Mutex.h
parent7006cb82bde1dbcd9465186fd31aa884e679f92c (diff)
downloadserenity-a8967388d3b6986dd10fab193c0b1fef287a4e18.zip
Kernel: Remove unused ScopedLockRelease class
Diffstat (limited to 'Kernel/Locking/Mutex.h')
-rw-r--r--Kernel/Locking/Mutex.h48
1 files changed, 0 insertions, 48 deletions
diff --git a/Kernel/Locking/Mutex.h b/Kernel/Locking/Mutex.h
index 9eb9c6a68b..481c8fc9fa 100644
--- a/Kernel/Locking/Mutex.h
+++ b/Kernel/Locking/Mutex.h
@@ -154,52 +154,4 @@ private:
bool m_locked { true };
};
-class ScopedLockRelease {
- AK_MAKE_NONCOPYABLE(ScopedLockRelease);
-
-public:
- ScopedLockRelease& operator=(ScopedLockRelease&&) = delete;
-
- ScopedLockRelease(Mutex& lock)
- : m_lock(&lock)
- , m_previous_mode(lock.force_unlock_if_locked(m_previous_recursions))
- {
- }
-
- ScopedLockRelease(ScopedLockRelease&& from)
- : m_lock(exchange(from.m_lock, nullptr))
- , m_previous_mode(exchange(from.m_previous_mode, Mutex::Mode::Unlocked))
- , m_previous_recursions(exchange(from.m_previous_recursions, 0))
- {
- }
-
- ~ScopedLockRelease()
- {
- if (m_lock && m_previous_mode != Mutex::Mode::Unlocked)
- m_lock->restore_lock(m_previous_mode, m_previous_recursions);
- }
-
- void restore_lock()
- {
- VERIFY(m_lock);
- if (m_previous_mode != Mutex::Mode::Unlocked) {
- m_lock->restore_lock(m_previous_mode, m_previous_recursions);
- m_previous_mode = Mutex::Mode::Unlocked;
- m_previous_recursions = 0;
- }
- }
-
- void do_not_restore()
- {
- VERIFY(m_lock);
- m_previous_mode = Mutex::Mode::Unlocked;
- m_previous_recursions = 0;
- }
-
-private:
- Mutex* m_lock;
- Mutex::Mode m_previous_mode;
- u32 m_previous_recursions;
-};
-
}