1 | #include "duckdb/main/connection_manager.hpp" |
---|---|
2 | |
3 | #include "duckdb/main/client_context.hpp" |
4 | #include "duckdb/main/connection.hpp" |
5 | |
6 | using namespace duckdb; |
7 | using namespace std; |
8 | |
9 | ConnectionManager::~ConnectionManager() { |
10 | std::lock_guard<std::mutex> lock(connections_lock); |
11 | for (auto &conn : connections) { |
12 | conn->context->Invalidate(); |
13 | } |
14 | } |
15 | |
16 | void ConnectionManager::AddConnection(Connection *conn) { |
17 | assert(conn); |
18 | std::lock_guard<std::mutex> lock(connections_lock); |
19 | connections.insert(conn); |
20 | } |
21 | |
22 | void ConnectionManager::RemoveConnection(Connection *conn) { |
23 | assert(conn); |
24 | std::lock_guard<std::mutex> lock(connections_lock); |
25 | connections.erase(conn); |
26 | } |
27 |