Function deinit [src]

Frees the connection pool and closes all connections within. This function is threadsafe. All future operations on the connection pool will deadlock.

Prototype

pub fn deinit(pool: *ConnectionPool, allocator: Allocator) void

Parameters

pool: *ConnectionPoolallocator: Allocator

Source

pub fn deinit(pool: *ConnectionPool, allocator: Allocator) void { pool.mutex.lock(); var next = pool.free.first; while (next) |node| { defer allocator.destroy(node); next = node.next; node.data.close(allocator); } next = pool.used.first; while (next) |node| { defer allocator.destroy(node); next = node.next; node.data.close(allocator); } pool.* = undefined; }