16 const std::string _name;
17 mutable std::atomic_flag _locked = ATOMIC_FLAG_INIT;
23 inline void lockRead()
const {
24 while (_locked.test_and_set(std::memory_order_acquire)) {
25 std::this_thread::yield();
29 inline void unlockRead()
const {
30 _locked.clear(std::memory_order_release);
33 inline void lockWrite() {
34 while (_locked.test_and_set(std::memory_order_acquire)) {
35 std::this_thread::yield();
39 inline void unlockWrite() {
40 _locked.clear(std::memory_order_release);
68 #ifndef AI_THREAD_LOCAL
69 #define AI_THREAD_LOCAL thread_local