mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 17:10:23 +00:00
Kernel: Remove no-longer-used Lockable template
This commit is contained in:
parent
fcf6ccd771
commit
8f3b3af5ea
Notes:
sideshowbarker
2024-07-17 22:10:19 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/8f3b3af5eac
1 changed files with 0 additions and 35 deletions
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Kernel/Locking/Mutex.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
template<typename T>
|
||||
class Lockable {
|
||||
public:
|
||||
Lockable() = default;
|
||||
Lockable(T&& resource)
|
||||
: m_resource(move(resource))
|
||||
{
|
||||
}
|
||||
[[nodiscard]] Mutex& lock() { return m_lock; }
|
||||
[[nodiscard]] T& resource() { return m_resource; }
|
||||
|
||||
[[nodiscard]] T lock_and_copy()
|
||||
{
|
||||
MutexLocker locker(m_lock);
|
||||
return m_resource;
|
||||
}
|
||||
|
||||
private:
|
||||
T m_resource;
|
||||
Mutex m_lock;
|
||||
};
|
||||
|
||||
}
|
Loading…
Reference in a new issue