]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/ipc/mem/PageStack.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / ipc / mem / PageStack.h
index d64cbd723d2e0ec75c43d3e2e13e3e0c5be2a1d5..6e22ade0105fd7c5f6bab64fe7194705ecda7ca6 100644 (file)
@@ -1,23 +1,30 @@
 /*
- * $Id$
+ * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
  *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
  */
 
 #ifndef SQUID_IPC_MEM_PAGE_STACK_H
 #define SQUID_IPC_MEM_PAGE_STACK_H
 
 #include "ipc/AtomicWord.h"
+#include "ipc/mem/FlexibleArray.h"
 
-namespace Ipc {
+namespace Ipc
+{
 
-namespace Mem {
+namespace Mem
+{
 
 class PageId;
 
 /// Atomic container of "free" page numbers inside a single SharedMemory space.
 /// Assumptions: all page numbers are unique, positive, have an known maximum,
 /// and can be temporary unavailable as long as they are never trully lost.
-class PageStack {
+class PageStack
+{
 public:
     typedef uint32_t Value; ///< stack item type (a free page number)
 
@@ -56,15 +63,15 @@ private:
     const Offset theCapacity; ///< stack capacity, i.e. theItems size
     const size_t thePageSize; ///< page size, used to calculate shared memory size
     /// lower bound for the number of free pages (may get negative!)
-    AtomicWordT<Offset> theSize;
+    Atomic::WordT<Offset> theSize;
 
     /// last readable item index; just a hint, not a guarantee
-    AtomicWordT<Offset> theLastReadable;
+    Atomic::WordT<Offset> theLastReadable;
     /// first writable item index; just a hint, not a guarantee
-    AtomicWordT<Offset> theFirstWritable;
+    Atomic::WordT<Offset> theFirstWritable;
 
-    typedef AtomicWordT<Value> Item;
-    Item theItems[]; ///< page number storage
+    typedef Atomic::WordT<Value> Item;
+    Ipc::Mem::FlexibleArray<Item> theItems; ///< page number storage
 };
 
 } // namespace Mem
@@ -72,3 +79,4 @@ private:
 } // namespace Ipc
 
 #endif // SQUID_IPC_MEM_PAGE_STACK_H
+