#include <PagePool.h>
Public Types | |
typedef Ipc::Mem::Owner< PageStack > | Owner |
Public Member Functions | |
PagePool (const char *const id) | |
unsigned int | capacity () const |
size_t | pageSize () const |
unsigned int | size () const |
lower bound for the number of free pages More... | |
size_t | level () const |
approximate number of shared memory pages used now More... | |
size_t | level (const int purpose) const |
approximate number of shared memory pages used now for given purpose More... | |
bool | get (const PageId::Purpose purpose, PageId &page) |
sets page ID and returns true unless no free pages are found More... | |
void | put (PageId &page) |
makes identified page available as a free page to future get() callers More... | |
char * | pagePointer (const PageId &page) |
converts page handler into a temporary writeable shared memory pointer More... | |
Static Public Member Functions | |
static Owner * | Init (const char *const shmId, const Ipc::Mem::PoolId stackId, const unsigned int capacity, const size_t pageSize) |
Private Types | |
using | Levels_t = PageStack::Levels_t |
Private Attributes | |
Ipc::Mem::Pointer< PageStack > | pageIndex |
free pages index More... | |
Levels_t *const | theLevels |
number of shared memory pages used now for each purpose More... | |
char *const | theBuf |
pages storage More... | |
Detailed Description
Atomic container of shared memory pages. Implemented using a collection of Segments, each with a PageStack index of free pages. All pools must be created by a single process.
Definition at line 25 of file PagePool.h.
Member Typedef Documentation
◆ Levels_t
|
private |
Definition at line 52 of file PagePool.h.
◆ Owner
Definition at line 28 of file PagePool.h.
Constructor & Destructor Documentation
◆ PagePool()
Ipc::Mem::PagePool::PagePool | ( | const char *const | id | ) |
Definition at line 29 of file PagePool.cc.
Member Function Documentation
◆ capacity()
|
inline |
◆ get()
bool Ipc::Mem::PagePool::get | ( | const PageId::Purpose | purpose, |
PageId & | page | ||
) |
Definition at line 46 of file PagePool.cc.
References Ipc::Mem::PageId::maxPurpose, Must, and Ipc::Mem::PageId::purpose.
Referenced by Ipc::Mem::GetPage().
◆ Init()
|
static |
Definition at line 19 of file PagePool.cc.
References capacity(), Ipc::Mem::PageStack::Config::capacity, Ipc::Mem::PageStack::Config::createFull, pageSize(), Ipc::Mem::PageStack::Config::pageSize, Ipc::Mem::PageStack::Config::poolId, and shm_new.
Referenced by SharedMemPagesRr::create().
◆ level() [1/2]
|
inline |
Definition at line 39 of file PagePool.h.
References capacity(), and size().
Referenced by Ipc::Mem::PageLevel().
◆ level() [2/2]
Definition at line 39 of file PagePool.cc.
References Ipc::Mem::PageId::maxPurpose, and Must.
◆ pagePointer()
char * Ipc::Mem::PagePool::pagePointer | ( | const PageId & | page | ) |
Definition at line 70 of file PagePool.cc.
References Must, and Ipc::Mem::PageId::number.
Referenced by Ipc::Mem::PagePointer().
◆ pageSize()
|
inline |
◆ put()
void Ipc::Mem::PagePool::put | ( | PageId & | page | ) |
Definition at line 58 of file PagePool.cc.
References Ipc::Mem::PageId::maxPurpose, Must, and Ipc::Mem::PageId::purpose.
Referenced by Ipc::Mem::PutPage().
◆ size()
|
inline |
Member Data Documentation
◆ pageIndex
|
private |
Definition at line 51 of file PagePool.h.
Referenced by capacity(), pageSize(), and size().
◆ theBuf
|
private |
Definition at line 56 of file PagePool.h.
◆ theLevels
|
private |
Definition at line 55 of file PagePool.h.
The documentation for this class was generated from the following files:
- src/ipc/mem/PagePool.h
- src/ipc/mem/PagePool.cc