Don't allow thread_pool locking to be set by ASIO_CONCURRENCY_HINT_ macros.

Conservatively prevent the thread_pool's internal locking behaviour from
being changed via the ASIO_CONCURRENCY_HINT_ macros, as there is no way
to use a thread_pool object in a purely single-threaded use case anyway.
This change also fixes a conversion warning.
This commit is contained in:
Christopher Kohlhoff 2019-02-28 09:39:57 +11:00
parent 51274de46a
commit 1a7b0c7220

View File

@ -44,8 +44,8 @@ thread_pool::thread_pool()
}
thread_pool::thread_pool(std::size_t num_threads)
: scheduler_(add_scheduler(new detail::scheduler(*this, num_threads == 1
? ASIO_CONCURRENCY_HINT_1 : num_threads, false)))
: scheduler_(add_scheduler(new detail::scheduler(
*this, num_threads == 1 ? 1 : 0, false)))
{
scheduler_.work_started();