File tree Expand file tree Collapse file tree 4 files changed +18
-11
lines changed Expand file tree Collapse file tree 4 files changed +18
-11
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ add_library(${project_name}-lib
1616
1717## link libs
1818
19- find_package (oatpp 0.19.1 REQUIRED)
19+ find_package (oatpp 0.19.4 REQUIRED)
2020
2121target_link_libraries (${project_name} -lib
2222 PUBLIC oatpp::oatpp
Original file line number Diff line number Diff line change 2323 */
2424class AppComponent {
2525public:
26-
26+
27+ /* *
28+ * Create Async Executor
29+ */
30+ OATPP_CREATE_COMPONENT (std::shared_ptr<oatpp::async::Executor>, executor)([] {
31+ return std::make_shared<oatpp::async::Executor>(
32+ 4 /* Data-Processing threads */ ,
33+ 1 /* I/O threads */ ,
34+ 1 /* Timer threads */
35+ );
36+ }());
37+
2738 /* *
2839 * Create ConnectionProvider component which listens on the port
2940 */
3041 OATPP_CREATE_COMPONENT (std::shared_ptr<oatpp::network::ServerConnectionProvider>, serverConnectionProvider)([] {
3142 /* non_blocking connections should be used with AsyncHttpConnectionHandler for AsyncIO */
32- return oatpp::network::server::SimpleTCPConnectionProvider::createShared (8000 , true /* true for non_blocking */ );
43+ return oatpp::network::server::SimpleTCPConnectionProvider::createShared (8000 );
3344 }());
3445
3546 /* *
@@ -44,8 +55,8 @@ class AppComponent {
4455 */
4556 OATPP_CREATE_COMPONENT (std::shared_ptr<oatpp::network::server::ConnectionHandler>, serverConnectionHandler)([] {
4657 OATPP_COMPONENT (std::shared_ptr<oatpp::web::server::HttpRouter>, router); // get Router component
47- /* Async ConnectionHandler for Async IO and Coroutine based endpoints */
48- return oatpp::web::server::AsyncHttpConnectionHandler::createShared (router);
58+ OATPP_COMPONENT (std::shared_ptr<oatpp::async::Executor>, executor); // get Async executor component
59+ return oatpp::web::server::AsyncHttpConnectionHandler::createShared (router, executor );
4960 }());
5061
5162 /* *
Original file line number Diff line number Diff line change 1111#include < iostream>
1212
1313void Logger::log (v_int32 priority, const std::string& tag, const std::string& message) {
14- oatpp::concurrency::SpinLock lock (m_atom );
14+ std::lock_guard< oatpp::concurrency::SpinLock> lock (m_lock );
1515 std::cout << tag << " :" << message << " \n " ;
1616}
Original file line number Diff line number Diff line change 1919 */
2020class Logger : public oatpp ::base::Logger {
2121private:
22- oatpp::concurrency::SpinLock::Atom m_atom ;
22+ oatpp::concurrency::SpinLock m_lock ;
2323public:
24-
25- Logger ()
26- : m_atom(false )
27- {}
2824
2925 void log (v_int32 priority, const std::string& tag, const std::string& message) override ;
3026
You can’t perform that action at this time.
0 commit comments