/*
- * $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)
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
} // namespace Ipc
#endif // SQUID_IPC_MEM_PAGE_STACK_H
+