Files
jsix_import/src/libraries/kutil/spinlock.h
Justin C. Miller 593cda3ee8 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
2018-09-11 20:46:48 -07:00

20 lines
274 B
C++

#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