Skip to content

Commit fdcc934

Browse files
authored
Update rw_lock.h for #143
1 parent f3bf137 commit fdcc934

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

include/libipc/rw_lock.h

+5-4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <limits>
77
#include <type_traits>
88
#include <utility>
9+
#include <cstdint>
910

1011
////////////////////////////////////////////////////////////////
1112
/// Gives hint to processor that improves performance of spin-wait loops.
@@ -98,7 +99,7 @@ inline void sleep(K& k) {
9899
namespace ipc {
99100

100101
class spin_lock {
101-
std::atomic<unsigned> lc_ { 0 };
102+
std::atomic<std::uint32_t> lc_ { 0 };
102103

103104
public:
104105
void lock(void) noexcept {
@@ -113,13 +114,13 @@ class spin_lock {
113114
};
114115

115116
class rw_lock {
116-
using lc_ui_t = unsigned;
117+
using lc_ui_t = std::uint32_t;
117118

118119
std::atomic<lc_ui_t> lc_ { 0 };
119120

120121
enum : lc_ui_t {
121-
w_mask = (std::numeric_limits<std::make_signed_t<lc_ui_t>>::max)(), // b 0111 1111
122-
w_flag = w_mask + 1 // b 1000 0000
122+
w_mask = (std::numeric_limits<std::make_signed_t<lc_ui_t>>::max)(), // b 0111 1111 ...
123+
w_flag = w_mask + 1 // b 1000 0000 ...
123124
};
124125

125126
public:

0 commit comments

Comments
 (0)