]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1073] Added minor comments
authorTomek Mrugalski <tomasz@isc.org>
Mon, 27 Jan 2020 10:43:22 +0000 (11:43 +0100)
committerRazvan Becheriu <razvan@isc.org>
Mon, 27 Jan 2020 14:57:36 +0000 (16:57 +0200)
src/lib/dhcpsrv/mysql_host_data_source.cc

index c145978b82178881cacead360cae5d35b604fa71..2a066b32cca9a808975cceabcd1d8cbf24b712cf 100644 (file)
@@ -2568,7 +2568,9 @@ MySqlHostDataSource::MySqlHostContextAlloc::MySqlHostContextAlloc(
     const MySqlHostDataSourceImpl& mgr) : ctx_(), mgr_(mgr) {
 
     if (MultiThreadingMgr::instance().getMode()) {
+        // multi-threaded
         {
+            // we need to protect the whole pool_ operation, hence extra scope {}
             lock_guard<mutex> lock(mgr_.pool_->mutex_);
             if (!mgr_.pool_->pool_.empty()) {
                 ctx_ = mgr_.pool_->pool_.back();
@@ -2579,6 +2581,7 @@ MySqlHostDataSource::MySqlHostContextAlloc::MySqlHostContextAlloc(
             ctx_ = mgr_.createContext();
         }
     } else {
+        // single threaded
         if (mgr_.pool_->pool_.empty()) {
             isc_throw(Unexpected, "No available MySQL lease context?!");
         }
@@ -2588,9 +2591,11 @@ MySqlHostDataSource::MySqlHostContextAlloc::MySqlHostContextAlloc(
 
 MySqlHostDataSource::MySqlHostContextAlloc::~MySqlHostContextAlloc() {
     if (MultiThreadingMgr::instance().getMode()) {
+        // multi-threaded
         lock_guard<mutex> lock(mgr_.pool_->mutex_);
         mgr_.pool_->pool_.push_back(ctx_);
     }
+    // If running in single-threaded mode, there's nothing to do here.
 }
 
 MySqlHostDataSourceImpl::MySqlHostDataSourceImpl(const MySqlConnection::ParameterMap& parameters)