Function deinit [src]
Frees the connection pool and closes all connections within.
All future operations on the connection pool will deadlock.
Threadsafe.
Prototype
pub fn deinit(pool: *ConnectionPool) void
Parameters
pool: *ConnectionPool
Source
pub fn deinit(pool: *ConnectionPool) void {
pool.mutex.lock();
var next = pool.free.first;
while (next) |node| {
const connection: *Connection = @alignCast(@fieldParentPtr("pool_node", node));
next = node.next;
connection.destroy();
}
next = pool.used.first;
while (next) |node| {
const connection: *Connection = @alignCast(@fieldParentPtr("pool_node", node));
next = node.next;
connection.destroy();
}
pool.* = undefined;
}