mirror of
https://github.com/CrowCpp/Crow.git
synced 2024-06-07 21:10:44 +00:00
Have concurrency
represent the actual number threads used
This commit is contained in:
parent
f4785cda68
commit
77758e6241
@ -156,8 +156,9 @@ namespace crow
|
||||
/// Run the server on multiple threads using a specific number
|
||||
self_t& concurrency(std::uint16_t concurrency)
|
||||
{
|
||||
if (concurrency < 1)
|
||||
concurrency = 1;
|
||||
if (concurrency < 2) // using 2 instead of 1 because 1 will be subtracted later.
|
||||
concurrency = 2;
|
||||
concurrency--; // Account for the main (acceptor) thread creating all the other threads.
|
||||
concurrency_ = concurrency;
|
||||
return *this;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ namespace crow
|
||||
signals_(io_service_),
|
||||
tick_timer_(io_service_),
|
||||
handler_(handler),
|
||||
concurrency_(concurrency == 0 ? 1 : concurrency),
|
||||
concurrency_(concurrency),
|
||||
timeout_(timeout),
|
||||
server_name_(server_name),
|
||||
port_(port),
|
||||
@ -137,8 +137,7 @@ namespace crow
|
||||
handler_->port(port_);
|
||||
|
||||
|
||||
CROW_LOG_INFO << server_name_ << " server is running at " << (handler_->ssl_used() ? "https://" : "http://") << bindaddr_ << ":" << acceptor_.local_endpoint().port()
|
||||
<< " using " << concurrency_ << " threads";
|
||||
CROW_LOG_INFO << server_name_ << " server is running at " << (handler_->ssl_used() ? "https://" : "http://") << bindaddr_ << ":" << acceptor_.local_endpoint().port() << " using " << (concurrency_ + 1) << " threads"; // +1 is for the main thread
|
||||
CROW_LOG_INFO << "Call `app.loglevel(crow::LogLevel::Warning)` to hide Info level logs.";
|
||||
|
||||
signals_.async_wait(
|
||||
|
Loading…
Reference in New Issue
Block a user