mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:37:35 +00:00
Kernel: Add locks around RangeAllocator
We need to keep multiple processors from changing it at the same time.
This commit is contained in:
parent
66f46d03e4
commit
2b25a89ab5
2 changed files with 10 additions and 0 deletions
|
@ -29,6 +29,7 @@
|
|||
#include <AK/String.h>
|
||||
#include <AK/Traits.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <Kernel/SpinLock.h>
|
||||
#include <Kernel/VirtualAddress.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
@ -92,6 +93,7 @@ public:
|
|||
|
||||
bool contains(const Range& range) const
|
||||
{
|
||||
ScopedSpinLock lock(m_lock);
|
||||
return m_total_range.contains(range);
|
||||
}
|
||||
|
||||
|
@ -100,6 +102,7 @@ private:
|
|||
|
||||
Vector<Range> m_available_ranges;
|
||||
Range m_total_range;
|
||||
mutable SpinLock<u8> m_lock;
|
||||
};
|
||||
|
||||
inline const LogStream& operator<<(const LogStream& stream, const Range& value)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue