Skip to content

Commit 39bcb4a

Browse files
committed
updated to oatpp veraion 0.19.4
1 parent 87df10b commit 39bcb4a

File tree

4 files changed

+18
-11
lines changed

4 files changed

+18
-11
lines changed

main/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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

2121
target_link_libraries(${project_name}-lib
2222
PUBLIC oatpp::oatpp

main/src/AppComponent.hpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,24 @@
2323
*/
2424
class AppComponent {
2525
public:
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
/**

main/src/Logger.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
#include <iostream>
1212

1313
void 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
}

main/src/Logger.hpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,8 @@
1919
*/
2020
class Logger : public oatpp::base::Logger {
2121
private:
22-
oatpp::concurrency::SpinLock::Atom m_atom;
22+
oatpp::concurrency::SpinLock m_lock;
2323
public:
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

0 commit comments

Comments
 (0)