Convert page_block to use kutil::linked_list
- Created a new linked_list-based slab allocator - Simplified memory bootstrap code by using the slab allocator and linked_lists
This commit is contained in:
19
src/libraries/kutil/spinlock.h
Normal file
19
src/libraries/kutil/spinlock.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
#include <atomic>
|
||||
|
||||
namespace kutil {
|
||||
|
||||
|
||||
class spinlock
|
||||
{
|
||||
public:
|
||||
spinlock() : m_lock(false) {}
|
||||
|
||||
inline void enter() { while (!m_lock.exchange(true)); }
|
||||
inline void leave() { m_lock.store(false); }
|
||||
|
||||
private:
|
||||
std::atomic<bool> m_lock;
|
||||
};
|
||||
|
||||
} // namespace kutil
|
||||
Reference in New Issue
Block a user