It is unsafe to use raw threadpool references everywhere. Instead, use std::shared_ptr.
The actual threadpool constructor can be hidden and only usable by a wrapper class that stores a shared_ptr of the threadpool. Then overload operator*/operator-> to dereference to the inner threadpool.
It is unsafe to use raw threadpool references everywhere. Instead, use
std::shared_ptr
.The actual threadpool constructor can be hidden and only usable by a wrapper class that stores a shared_ptr of the threadpool. Then overload
operator*
/operator->
to dereference to the inner threadpool.