| Home | Libraries | People | FAQ | More

##### 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. Thread-safety does not protect objects that don't belong to the pool. For instance, `asio::cancel_after` creates a timer that must be protected with a strand. Refer to this page for more info.