]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Convert ReadWriteLock to std::atomic
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 2 Jun 2015 10:04:27 +0000 (03:04 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 2 Jun 2015 10:04:27 +0000 (03:04 -0700)
src/ipc/MemMap.h
src/ipc/ReadWriteLock.h
src/ipc/StoreMap.h

index 170df34a16421d1fa1029910c9ca619a38044212..d31179e5424d478d6866c140504d66ae51dc87b0 100644 (file)
@@ -10,6 +10,7 @@
 #define SQUID_IPC_STORE_MAP_H
 
 #include "Debug.h"
+#include "ipc/AtomicWord.h"
 #include "ipc/mem/FlexibleArray.h"
 #include "ipc/mem/Pointer.h"
 #include "ipc/ReadWriteLock.h"
index 65ec41b5867ab188726a84f56d0fa6ce040c7c54..511a29eb9da7d2c5ba4a4e7cd8e754b1e8c81387 100644 (file)
@@ -9,7 +9,7 @@
 #ifndef SQUID_IPC_READ_WRITE_LOCK_H
 #define SQUID_IPC_READ_WRITE_LOCK_H
 
-#include "ipc/AtomicWord.h"
+#include <atomic>
 
 class StoreEntry;
 
@@ -39,13 +39,13 @@ public:
     void updateStats(ReadWriteLockStats &stats) const;
 
 public:
-    mutable Atomic::Word readers; ///< number of reading users
-    Atomic::Word writing; ///< there is a writing user (there can be at most 1)
-    Atomic::Word appending; ///< the writer has promissed to only append
+    mutable std::atomic<uint32_t> readers; ///< number of reading users
+    std::atomic<bool> writing; ///< there is a writing user (there can be at most 1)
+    std::atomic<bool> appending; ///< the writer has promissed to only append
 
 private:
-    mutable Atomic::Word readLevel; ///< number of users reading (or trying to)
-    Atomic::Word writeLevel; ///< number of users writing (or trying to write)
+    mutable std::atomic<uint32_t> readLevel; ///< number of users reading (or trying to)
+    std::atomic<uint32_t> writeLevel; ///< number of users writing (or trying to write)
 };
 
 /// approximate stats of a set of ReadWriteLocks
index feaafe60dcbf9046a804fc2502c83aef66de4103..b523e065ba2c8f52d5692cbc82b24a9487c29349 100644 (file)
@@ -9,6 +9,7 @@
 #ifndef SQUID_IPC_STORE_MAP_H
 #define SQUID_IPC_STORE_MAP_H
 
+#include "ipc/AtomicWord.h"
 #include "ipc/mem/FlexibleArray.h"
 #include "ipc/mem/Pointer.h"
 #include "ipc/ReadWriteLock.h"