return 32*1024;
}
-void
-Ipc::Mem::Init()
-{
- Must(!ThePagePool);
- const size_t capacity = Limit() / PageSize();
- ThePagePool = new PagePool(PagePoolId, capacity, PageSize());
-}
-
-void
-Ipc::Mem::Attach()
-{
- Must(!ThePagePool);
- // TODO: make pool id more unique so it does not conflict with other Squid instances?
- ThePagePool = new PagePool(PagePoolId);
-}
-
bool
Ipc::Mem::GetPage(PageId &page)
{
return;
}
- if (IamMasterProcess())
- Ipc::Mem::Init();
- else
- Ipc::Mem::Attach();
+ Must(!ThePagePool);
+ if (IamMasterProcess()) {
+ const size_t capacity = Ipc::Mem::Limit() / Ipc::Mem::PageSize();
+ ThePagePool =
+ new Ipc::Mem::PagePool(PagePoolId, capacity, Ipc::Mem::PageSize());
+ } else
+ ThePagePool = new Ipc::Mem::PagePool(PagePoolId);
}
SharedMemPagesRr::~SharedMemPagesRr()
class PageId;
-/// initializes and configures shared memory [pools] for all kids
-void Init();
-
-/// attaches this kid to the already configured shared memory [pools]
-void Attach();
-
/* Single page manipulation */
/// sets page ID and returns true unless no free pages are found