Skip to content

Commit 6b7bf1f

Browse files
committed
Use lock-free atomics
1 parent 78e14d3 commit 6b7bf1f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/nbl/system/demote_promote_writer_readers_lock.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef __NBL_DEMOTE_PROMOTE_WRITER_READERS_LOCK_H_INCLUDED__
22
#define __NBL_DEMOTE_PROMOTE_WRITER_READERS_LOCK_H_INCLUDED__
33

4-
#include <atomic>
4+
#include <boost/atomic/atomic.hpp>
55
#include <thread>
66
#include <mutex> // for std::adopt_lock_t
77

@@ -25,8 +25,8 @@ class demote_promote_writer_readers_lock
2525
uint32_t writing : 1 = 0;
2626
uint32_t stateLocked : 1 = 0;
2727
};
28-
std::atomic_uint32_t state;
29-
28+
boost::atomic_unsigned_lock_free state;
29+
3030
constexpr uint32_t flipLock = StateSemantics{ .currentReaders = 0,.pendingWriters = 0,.pendingUpgrades = 0,.writing = false,.stateLocked = true };
3131
constexpr uint32_t writingMask = StateSemantics{ .currentReaders = 0,.pendingWriters = 0,.pendingUpgrades = 0,.writing = true,.stateLocked = false };
3232

0 commit comments

Comments
 (0)