pool
Generated by tinox doc
tinox.core.pool, bundled with the compiler and also available as a standalone tinox-central package.
Object pool
import tinox.core.pool
class Main
{
fnc main() -> Int32
{
const connections: Pool<String> = Pool<String>::newWithFactory(5, \-> "new-connection")
const c1: String = Pool::acquire(connections)
println("acquired: " + c1)
Pool::release(connections, c1)
return 0
}
}
class Pool<T>
Fields
available | List<T> | |
inUse | List<T> | |
maxSize | Int64 | |
factory | fnc() -> T |
Methods
fn new(maxSize: Int64) → Pool<T>
fn newWithFactory(maxSize: Int64, factory: fnc() -> T) → Pool<T>
fn acquire(pool: Pool<T>) → T
fn release(pool: Pool<T>, obj: T) → Nothing
fn clear(pool: Pool<T>) → Nothing