Date: Friday, December 8, 2006 @ 16:07:10
  Author: gilles
    Path: /cvsroot/carob/carob

Modified: include/ControllerPool.hpp (1.8 -> 1.9) src/ControllerPool.cpp
          (1.13 -> 1.14)

Pool lock is no more static
Added synchro in all AbstractControllerPool functions


----------------------------+
 include/ControllerPool.hpp |    6 +++---
 src/ControllerPool.cpp     |    7 ++++---
 2 files changed, 7 insertions(+), 6 deletions(-)


Index: carob/include/ControllerPool.hpp
diff -u carob/include/ControllerPool.hpp:1.8 
carob/include/ControllerPool.hpp:1.9
--- carob/include/ControllerPool.hpp:1.8        Mon Dec  4 15:13:48 2006
+++ carob/include/ControllerPool.hpp    Fri Dec  8 16:07:10 2006
@@ -127,7 +127,7 @@
   /**
    * Display useful info in a string
    */
-  operator                    std::wstring() const;
+  operator                    std::wstring();
 protected:
   /**
    * Tells the pool that a new connection is using it
@@ -140,8 +140,8 @@
   int                         removeRef() { ref_counter--; return ref_counter; 
}
   /** Up-to-date list of controllers that respond to pings */
   std::vector<ControllerInfo> alive_controllers;
-  /** class-wide mutex */
-  static CriticalSection      pool_CS;
+  /** Mutex on alive controllers */
+  CriticalSection             pool_CS;
 private:
   // Forbid copies and empty construction
   AbstractControllerPool();
Index: carob/src/ControllerPool.cpp
diff -u carob/src/ControllerPool.cpp:1.13 carob/src/ControllerPool.cpp:1.14
--- carob/src/ControllerPool.cpp:1.13   Fri Dec  8 14:18:22 2006
+++ carob/src/ControllerPool.cpp        Fri Dec  8 16:07:10 2006
@@ -39,8 +39,6 @@
 
////////////////////////////////////////////////////////////////////////////////
 //                           ABSTRACT CONTROLLER POOL
 
////////////////////////////////////////////////////////////////////////////////
-/* static members declaration */
-CriticalSection AbstractControllerPool::pool_CS;
 
 AbstractControllerPool::AbstractControllerPool(
     const vector<ControllerInfo>& controllerList, int pingDelayInMs,
@@ -90,11 +88,13 @@
 void AbstractControllerPool::registerSocket(const ControllerInfo& controller,
     JavaSocket* socket)
 {
+  LockScope ls(&pool_CS);
   callback_ptr->registerSocket(controller, socket);
 }
 
 void AbstractControllerPool::forceControllerDown(const ControllerInfo& 
controller)
 {
+  LockScope ls(&pool_CS);
   watcher_ptr->forceControllerDown(controller);
 }
 
@@ -118,8 +118,9 @@
   alive_controllers.push_back(controller);
 }
 
-AbstractControllerPool::operator wstring() const
+AbstractControllerPool::operator wstring()
 {
+  LockScope ls(&pool_CS);
   wstring sRet(L"controller list: ");
   for (size_t i = 0; i < alive_controllers.size(); i++)
   {

_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits

Reply via email to