From: Dmitry Kurochkin Date: Tue, 19 Apr 2011 04:06:00 +0000 (+0400) Subject: Cleanup Pages initialization: X-Git-Tag: take06~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=826e236d69778d135bbd770ce7bc11e7b107049e;p=thirdparty%2Fsquid.git Cleanup Pages initialization: * remove Pages::Init() and Pages::Attach() * do init in SharedMemPagesRr::run() --- diff --git a/src/ipc/mem/Pages.cc b/src/ipc/mem/Pages.cc index dccb7b0e7d..f341965f91 100644 --- a/src/ipc/mem/Pages.cc +++ b/src/ipc/mem/Pages.cc @@ -26,22 +26,6 @@ Ipc::Mem::PageSize() { 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) { @@ -109,10 +93,13 @@ void SharedMemPagesRr::run(const RunnerRegistry &) 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() diff --git a/src/ipc/mem/Pages.h b/src/ipc/mem/Pages.h index 9c97155503..db22271435 100644 --- a/src/ipc/mem/Pages.h +++ b/src/ipc/mem/Pages.h @@ -12,12 +12,6 @@ namespace Mem { 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