From 739b3db69cf802214113b0a30ea6b52374fd1ede Mon Sep 17 00:00:00 2001 From: byronhe <1394332+byronhe@users.noreply.github.com> Date: Sat, 24 Apr 2021 19:17:01 +0800 Subject: [PATCH] Update connection_pool.h (#363) --- include/sqlpp11/connection_pool.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/include/sqlpp11/connection_pool.h b/include/sqlpp11/connection_pool.h index 14e4e81b..e2d057fa 100644 --- a/include/sqlpp11/connection_pool.h +++ b/include/sqlpp11/connection_pool.h @@ -173,12 +173,14 @@ namespace sqlpp pool_connection get_connection() { - std::lock_guard lock(connection_pool_mutex); - if (!free_connections.empty()) { - auto connection = std::move(free_connections.top()); - free_connections.pop(); - return pool_connection(connection, this); + std::lock_guard lock(connection_pool_mutex); + if (!free_connections.empty()) + { + auto connection = std::move(free_connections.top()); + free_connections.pop(); + return pool_connection(connection, this); + } } try