switch from unique to shared ptr
This commit is contained in:
parent
8f8cb6a52f
commit
96318bbe11
@ -49,12 +49,13 @@ class Server
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static std::unique_ptr<Server> CreateServer(std::string &ip_address, int ip_port, unsigned requested_num_threads)
|
// Note: returns a shared instead of a unique ptr as it is captured in a lambda somewhere else
|
||||||
|
static std::shared_ptr<Server> CreateServer(std::string &ip_address, int ip_port, unsigned requested_num_threads)
|
||||||
{
|
{
|
||||||
SimpleLogger().Write() << "http 1.1 compression handled by zlib version " << zlibVersion();
|
SimpleLogger().Write() << "http 1.1 compression handled by zlib version " << zlibVersion();
|
||||||
const unsigned hardware_threads = std::max(1u, std::thread::hardware_concurrency());
|
const unsigned hardware_threads = std::max(1u, std::thread::hardware_concurrency());
|
||||||
const unsigned real_num_threads = std::min(hardware_threads, requested_num_threads);
|
const unsigned real_num_threads = std::min(hardware_threads, requested_num_threads);
|
||||||
return osrm::make_unique<Server>(ip_address, ip_port, real_num_threads);
|
return std::make_shared<Server>(ip_address, ip_port, real_num_threads);
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit Server(const std::string &address, const int port, const unsigned thread_pool_size)
|
explicit Server(const std::string &address, const int port, const unsigned thread_pool_size)
|
||||||
|
Loading…
Reference in New Issue
Block a user