From fdcc9340be9dce63a2f6b9d91c745f3864677816 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=A8=E5=A4=B4=E4=BA=91?= Date: Sun, 20 Apr 2025 13:58:42 +0800 Subject: [PATCH] Update rw_lock.h for #143 --- include/libipc/rw_lock.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/libipc/rw_lock.h b/include/libipc/rw_lock.h index 31ed9de..bdd7276 100755 --- a/include/libipc/rw_lock.h +++ b/include/libipc/rw_lock.h @@ -6,6 +6,7 @@ #include #include #include +#include //////////////////////////////////////////////////////////////// /// Gives hint to processor that improves performance of spin-wait loops. @@ -98,7 +99,7 @@ inline void sleep(K& k) { namespace ipc { class spin_lock { - std::atomic lc_ { 0 }; + std::atomic lc_ { 0 }; public: void lock(void) noexcept { @@ -113,13 +114,13 @@ public: }; class rw_lock { - using lc_ui_t = unsigned; + using lc_ui_t = std::uint32_t; std::atomic lc_ { 0 }; enum : lc_ui_t { - w_mask = (std::numeric_limits>::max)(), // b 0111 1111 - w_flag = w_mask + 1 // b 1000 0000 + w_mask = (std::numeric_limits>::max)(), // b 0111 1111 ... + w_flag = w_mask + 1 // b 1000 0000 ... }; public: