aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--odb/mysql/connection-factory.cxx10
-rw-r--r--odb/mysql/connection-factory.hxx6
2 files changed, 9 insertions, 7 deletions
diff --git a/odb/mysql/connection-factory.cxx b/odb/mysql/connection-factory.cxx
index 2d86b82..bef21ce 100644
--- a/odb/mysql/connection-factory.cxx
+++ b/odb/mysql/connection-factory.cxx
@@ -226,7 +226,7 @@ namespace odb
}
}
- void connection_pool_factory::
+ bool connection_pool_factory::
release (pooled_connection* c)
{
c->clear ();
@@ -249,6 +249,8 @@ namespace odb
if (waiters_ != 0)
cond_.signal ();
+
+ return !keep;
}
//
@@ -264,13 +266,11 @@ namespace odb
shared_base::callback_ = &callback_;
}
- void connection_pool_factory::pooled_connection::
+ bool connection_pool_factory::pooled_connection::
zero_counter (void* arg)
{
pooled_connection* c (static_cast<pooled_connection*> (arg));
-
- if (c->pool_)
- c->pool_->release (c);
+ return c->pool_ ? c->pool_->release (c) : true;
}
}
}
diff --git a/odb/mysql/connection-factory.hxx b/odb/mysql/connection-factory.hxx
index 43d6f9f..eb7380c 100644
--- a/odb/mysql/connection-factory.hxx
+++ b/odb/mysql/connection-factory.hxx
@@ -119,7 +119,7 @@ namespace odb
pooled_connection (database_type&, connection_pool_factory*);
private:
- static void
+ static bool
zero_counter (void*);
private:
@@ -133,7 +133,9 @@ namespace odb
typedef std::vector<details::shared_ptr<pooled_connection> > connections;
private:
- void
+ // Return true if the connection should be deleted, false otherwise.
+ //
+ bool
release (pooled_connection*);
private: