feat(kcp, pfa): Add kcp::Spinlock class
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Spinlock.cpp
|
||||
* C++ Spinlock
|
||||
* Copyright (c) 2025 Daniel Hammer
|
||||
*/
|
||||
|
||||
#include "Spinlock.hpp"
|
||||
|
||||
namespace kcp {
|
||||
void Spinlock::Aquire() {
|
||||
while (atomic_flag.test_and_set(std::memory_order_acquire));
|
||||
}
|
||||
|
||||
void Spinlock::Release() {
|
||||
atomic_flag.clear(std::memory_order_release);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user