Skip to content

Commit

Permalink
Merge pull request #871 from redboltz/add_auto_threads_per_ioc
Browse files Browse the repository at this point in the history
Add auto threads per ioc
  • Loading branch information
redboltz authored Sep 27, 2021
2 parents 66f384d + bfcc7f3 commit e85fb39
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## 12.0.0
* Added io_context and threads setting options for example broker (#866)
* Improved exampless (#870)
* Fixed example broker's invalid sync connack call (#869)
* Added no CONNACK sending mode to the example broker (#869)
* Added posting code to acceptors (#867)
* Added io_context and threads setting options for example broker (#866, #871)
* Fixed moved from object access (#865)
* <<<< breaking change >>>> Removed ioc_con() and ioc_accept() (#866)
* <<<< breaking change >>>> Unified automatic async/sync choosing flag. (#857, #862)
Expand All @@ -14,7 +18,7 @@
* Added multi thread support for example broker (#842, #855, #866)
* Replaced example broker's API call from sync to async (#842)
* Replaced use_certificate_file() with use_certificate_chain_file() to support both server cert and server - intermediate CA cert (#841)
* <<<< breaking change >>>> Added async_force_disconnect(). force_disconnect() is removed from async_client (#840)
* <<<< breaking change >>>> Added async_force_disconnect(). force_disconnect() is removed from async_client (#840, #868)
* Added will delay interval support (#839)
* Fixed async_handler_t calling timing (#836)
* Added BOOST_ASIO_NO_TS_EXECUTORS support (#830)
Expand Down
5 changes: 3 additions & 2 deletions example/broker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <boost/program_options.hpp>

#include <fstream>
#include <algorithm>

namespace as = boost::asio;

Expand Down Expand Up @@ -349,8 +350,8 @@ void run_broker(boost::program_options::variables_map const& vm) {
return 1;
} ();
if (threads_per_ioc == 0) {
MQTT_LOG("mqtt_broker", error) << "threads per ioc must be greater than 0";
return;
threads_per_ioc = std::max(std::size_t(std::thread::hardware_concurrency()), std::size_t(4));
MQTT_LOG("mqtt_broker", info) << "threads_per_ioc set to auto decide (0). Automatically set to " << threads_per_ioc;
}

MQTT_LOG("mqtt_broker", info)
Expand Down

0 comments on commit e85fb39

Please sign in to comment.