diff options
Diffstat (limited to 'Kernel/Locking/SpinLockResource.h')
-rw-r--r-- | Kernel/Locking/SpinLockResource.h | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/Kernel/Locking/SpinLockResource.h b/Kernel/Locking/SpinLockResource.h deleted file mode 100644 index f8d23b5da0..0000000000 --- a/Kernel/Locking/SpinLockResource.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2021, the SerenityOS developers. - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -#include <AK/StdLibExtras.h> -#include <Kernel/Locking/SpinLock.h> - -namespace Kernel { - -template<typename T> -class SpinLockLockedResource { - AK_MAKE_NONCOPYABLE(SpinLockLockedResource); - -public: - SpinLockLockedResource(T* value, RecursiveSpinLock& spinlock) - : m_value(value) - , m_scoped_spinlock(spinlock) - { - } - - ALWAYS_INLINE T const* operator->() const { return m_value; } - ALWAYS_INLINE T const& operator*() const { return *m_value; } - - ALWAYS_INLINE T* operator->() { return m_value; } - ALWAYS_INLINE T& operator*() { return *m_value; } - - ALWAYS_INLINE T const* get() const { return m_value; } - ALWAYS_INLINE T* get() { return m_value; } - -private: - T* m_value; - ScopedSpinLock<RecursiveSpinLock> m_scoped_spinlock; -}; - -class SpinLockContendedResource { - template<typename> - friend class SpinLockLockedResource; - - AK_MAKE_NONCOPYABLE(SpinLockContendedResource); - AK_MAKE_NONMOVABLE(SpinLockContendedResource); - -public: - SpinLockContendedResource() = default; - -protected: - mutable RecursiveSpinLock m_spinlock; -}; - -} |