From: Amos Jeffries Date: Tue, 2 Jun 2015 09:14:22 +0000 (-0700) Subject: Refactor Ipc::Mem::PagePool using std::atomic X-Git-Tag: merge-candidate-3-v1~72^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=98b3fdc41ef38cbaa90d417bbe8e1b76b331d8cc;p=thirdparty%2Fsquid.git Refactor Ipc::Mem::PagePool using std::atomic --- diff --git a/src/ipc/mem/PagePool.cc b/src/ipc/mem/PagePool.cc index 7753d37bee..442b793ea5 100644 --- a/src/ipc/mem/PagePool.cc +++ b/src/ipc/mem/PagePool.cc @@ -26,7 +26,7 @@ Ipc::Mem::PagePool::Init(const char *const id, const unsigned int capacity, cons Ipc::Mem::PagePool::PagePool(const char *const id): pageIndex(shm_old(PageStack)(id)), - theLevels(reinterpret_cast( + theLevels(reinterpret_cast( reinterpret_cast(pageIndex.getRaw()) + pageIndex->stackSize())), theBuf(reinterpret_cast(theLevels + PageId::maxPurpose)) diff --git a/src/ipc/mem/PagePool.h b/src/ipc/mem/PagePool.h index 9622574fd0..5c32b3e46c 100644 --- a/src/ipc/mem/PagePool.h +++ b/src/ipc/mem/PagePool.h @@ -9,7 +9,6 @@ #ifndef SQUID_IPC_MEM_PAGE_POOL_H #define SQUID_IPC_MEM_PAGE_POOL_H -#include "ipc/AtomicWord.h" #include "ipc/mem/Page.h" #include "ipc/mem/PageStack.h" #include "ipc/mem/Pointer.h" @@ -50,8 +49,9 @@ public: private: Ipc::Mem::Pointer pageIndex; ///< free pages index + typedef std::atomic Levels_t; /// number of shared memory pages used now for each purpose - Atomic::Word *const theLevels; + Levels_t * const theLevels; char *const theBuf; ///< pages storage };