Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext
pool_params::thread_safe

Enables or disables thread-safety.

Synopsis
bool thread_safe {false};
Description

When set to true, the resulting connection pool are able to be shared between threads at the cost of some performance.

Enabling thread safety for a pool creates an internal asio::strand object wrapping the executor passed to the pool's constructor. All state-mutating functions (including connection_pool::async_run, connection_pool::async_get_connection and returning connections) will be run through the created strand.

Thread-safety doesn't extend to individual connections: pooled_connection objects can't be shared between threads.


PrevUpHomeNext