0
0
mirror of https://github.com/rbock/sqlpp11.git synced 2024-11-15 20:31:16 +08:00

Update connection_pool.h (#363)

This commit is contained in:
byronhe 2021-04-24 19:17:01 +08:00 committed by GitHub
parent 9203e3818f
commit 739b3db69c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -173,12 +173,14 @@ namespace sqlpp
pool_connection<Connection_config, Reconnect_policy, Connection> get_connection()
{
std::lock_guard<std::mutex> lock(connection_pool_mutex);
if (!free_connections.empty())
{
auto connection = std::move(free_connections.top());
free_connections.pop();
return pool_connection<Connection_config, Reconnect_policy, Connection>(connection, this);
std::lock_guard<std::mutex> lock(connection_pool_mutex);
if (!free_connections.empty())
{
auto connection = std::move(free_connections.top());
free_connections.pop();
return pool_connection<Connection_config, Reconnect_policy, Connection>(connection, this);
}
}
try