| Home | Libraries | People | FAQ | More

###### connection_pool::connection_pool (1 of 3 overloads)

Constructs a connection pool.

###### Synopsis

    connection_pool(
        asio::any_io_executor ex,
        pool_params params);

###### Description

The pool is created in a "not-running" state. Call `async_run` to transition to the "running" state.

The constructed pool is always valid (`this->valid() == true`).

###### Executor

The passed executor becomes the pool executor, available through `get_executor`. `ex` is used as follows:

- If `params.thread_safe == true`, `ex` is used to build a strand. The strand is used to build internal I/O objects, like timers.
- If `params.thread_safe == false`, `ex` is used directly to build internal I/O objects.
- If `params.connection_executor` is empty, `ex` is used to build individual connections, regardless of the chosen thread-safety mode. Otherwise, `params.connection_executor` is used.

###### Exception safety

Strong guarantee. Exceptions may be thrown by memory allocations.

###### Exceptions

Type | Thrown On
--- | ---
`std::invalid_argument` | If `params` contains values that violate the rules described in `pool_params`.