cache_key key[SQUID_MD5_DIGEST_LENGTH];
StoreEntry loadedE;
const uint64_t knownSize = header.entrySize > 0 ?
- header.entrySize : anchor.basics.swap_file_sz.get();
+ header.entrySize : anchor.basics.swap_file_sz.load();
if (!storeRebuildParseEntry(buf, loadedE, key, counts, knownSize))
return false;
#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"
typedef uint32_t Size;
StoreMapSlice(): size(0), next(-1) {}
-
- Atomic::WordT<Size> size; ///< slice contents size
- Atomic::WordT<StoreMapSliceId> next; ///< ID of the next entry slice
+ StoreMapSlice(const StoreMapSlice &o) {
+ size.exchange(o.size);
+ next.exchange(o.next);
+ }
+
+ StoreMapSlice &operator =(const StoreMapSlice &o) {
+ size.store(o.size);
+ next.store(o.next);
+ return *this;
+ }
+
+ std::atomic<Size> size; ///< slice contents size
+ std::atomic<StoreMapSliceId> next; ///< ID of the next entry slice
};
/// Maintains shareable information about a StoreEntry as a whole.
public:
mutable ReadWriteLock lock; ///< protects slot data below
- Atomic::WordT<uint8_t> waitingToBeFreed; ///< may be accessed w/o a lock
+ std::atomic<uint8_t> waitingToBeFreed; ///< may be accessed w/o a lock
// fields marked with [app] can be modified when appending-while-reading
time_t lastref;
time_t expires;
time_t lastmod;
- Atomic::WordT<uint64_t> swap_file_sz; // [app]
+ std::atomic<uint64_t> swap_file_sz; // [app]
uint16_t refcount;
uint16_t flags;
} basics;
/// where the chain of StoreEntry slices begins [app]
- Atomic::WordT<StoreMapSliceId> start;
+ std::atomic<StoreMapSliceId> start;
};
/// an array of shareable Items
size_t sharedMemorySize() const;
static size_t SharedMemorySize(const int anAnchorLimit);
- Atomic::Word count; ///< current number of entries
- Atomic::WordT<uint32_t> victim; ///< starting point for purge search
+ std::atomic<int32_t> count; ///< current number of entries
+ std::atomic<uint32_t> victim; ///< starting point for purge search
const int capacity; ///< total number of anchors
Ipc::Mem::FlexibleArray<StoreMapAnchor> items; ///< anchors storage
};