summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-03-07 20:25:43 +0100
committerAndreas Kling <kling@serenityos.org>2022-03-08 00:19:49 +0100
commit71792e4b3fafbf54b97d20b1be915043a79b2eb6 (patch)
tree9aac1e6bfd982cfff8a70256ee5bf84226f6d259
parent7543c34d0712c07ab9ba97549063f03b914124e8 (diff)
downloadserenity-71792e4b3fafbf54b97d20b1be915043a79b2eb6.zip
Kernel: Make SpinlockProtected constructor forward all arguments
This allows you to instantiate SpinlockProtected<T> where T requires constructor arguments.
-rw-r--r--Kernel/Locking/SpinlockProtected.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/Kernel/Locking/SpinlockProtected.h b/Kernel/Locking/SpinlockProtected.h
index 39a7b134b2..dd0344708c 100644
--- a/Kernel/Locking/SpinlockProtected.h
+++ b/Kernel/Locking/SpinlockProtected.h
@@ -46,7 +46,11 @@ private:
auto lock_mutable() { return Locked<T>(m_value, m_spinlock); }
public:
- SpinlockProtected() = default;
+ template<typename... Args>
+ SpinlockProtected(Args&&... args)
+ : m_value(forward<Args>(args)...)
+ {
+ }
template<typename Callback>
decltype(auto) with(Callback callback) const