]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Cleanup Pages initialization:
authorDmitry Kurochkin <dmitry.kurochkin@measurement-factory.com>
Tue, 19 Apr 2011 04:06:00 +0000 (08:06 +0400)
committerDmitry Kurochkin <dmitry.kurochkin@measurement-factory.com>
Tue, 19 Apr 2011 04:06:00 +0000 (08:06 +0400)
* remove Pages::Init() and Pages::Attach()
* do init in SharedMemPagesRr::run()

src/ipc/mem/Pages.cc
src/ipc/mem/Pages.h

index dccb7b0e7d4f6e560f9d28d8988548cfb29d836b..f341965f9112183c4a97efd2e59b9d0aebcc7dab 100644 (file)
@@ -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()
index 9c97155503ede5c539923b93e0fe12c2916ad9c7..db22271435c9456093296ad84bbdb9e92c697d90 100644 (file)
@@ -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