ladybird/Kernel/Locking
Jean-Baptiste Boric 75260bff92 Kernel: Introduce ProtectedValue
A protected value is a variable with enforced locking semantics. The
value is protected with a Mutex and can only be accessed through a
Locked object that holds a MutexLocker to said Mutex. Therefore, the
value itself cannot be accessed except through the proper locking
mechanism, which enforces correct locking semantics.

The Locked object has knowledge of shared and exclusive lock types and
will only return const-correct references and pointers. This should
help catch incorrect locking usage where a shared lock is acquired but
the user then modifies the locked value.

This is not a perfect solution because dereferencing the Locked object
returns the value, so the caller could defeat the protected value
semantics once it acquires a lock by keeping a pointer or a reference
to the value around. Then again, this is C++ and we can't protect
against malicious users from within the kernel anyways, but we can
raise the threshold above "didn't pay attention".
2021-08-07 11:48:00 +02:00
..
ContendedResource.h Kernel: Introduce contended and locked resource concepts 2021-08-07 11:48:00 +02:00
Lockable.h Kernel: Move Lockable into its own header 2021-08-07 11:48:00 +02:00
LockMode.h Kernel: Move LockMode into Locking/ 2021-08-07 11:48:00 +02:00
Mutex.cpp Kernel: Move SpinLock.h into Locking/ 2021-08-07 11:48:00 +02:00
Mutex.h Kernel: Move Lockable into its own header 2021-08-07 11:48:00 +02:00
NonnullRefContendedPtr.h Kernel: Implement contended, ref-counted resource framework 2021-08-07 11:48:00 +02:00
NonnullRefContendedPtrVector.h Kernel: Implement contended, ref-counted resource framework 2021-08-07 11:48:00 +02:00
ProtectedValue.h Kernel: Introduce ProtectedValue 2021-08-07 11:48:00 +02:00
RefContendedPtr.h Kernel: Implement contended, ref-counted resource framework 2021-08-07 11:48:00 +02:00
RefCountedContended.h Kernel: Implement contended, ref-counted resource framework 2021-08-07 11:48:00 +02:00
SpinLock.h Kernel: Move SpinLock.h into Locking/ 2021-08-07 11:48:00 +02:00
SpinLockProtectedValue.h Kernel: Introduce spin-locked contended and locked resource concepts 2021-08-07 11:48:00 +02:00
SpinLockResource.h Kernel: Introduce spin-locked contended and locked resource concepts 2021-08-07 11:48:00 +02:00