aboutsummaryrefslogtreecommitdiffstats
path: root/include/http_server.h
diff options
context:
space:
mode:
authoripknHama <ipknhama@gmail.com>2014-08-16 11:55:26 +0900
committeripknHama <ipknhama@gmail.com>2014-08-16 11:55:26 +0900
commitef51b97d8b5647a2a474b382e8772711cdfd8327 (patch)
tree2cdd483b0cd569d6a66bf760d54ad0b15fd4c8fb /include/http_server.h
parentc5cbb3ff54119855e63dff9666fd490a92f0db76 (diff)
downloadcrow-ef51b97d8b5647a2a474b382e8772711cdfd8327.tar.gz
crow-ef51b97d8b5647a2a474b382e8772711cdfd8327.zip
Change to custom timer implementation to increase performance
Diffstat (limited to 'include/http_server.h')
-rw-r--r--include/http_server.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/include/http_server.h b/include/http_server.h
index 228cc8c..73f62f0 100644
--- a/include/http_server.h
+++ b/include/http_server.h
@@ -10,6 +10,7 @@
#include "http_connection.h"
#include "datetime.h"
#include "logging.h"
+#include "dumb_timer_queue.h"
namespace crow
{
@@ -36,8 +37,15 @@ namespace crow
std::vector<std::future<void>> v;
for(uint16_t i = 0; i < concurrency_; i ++)
v.push_back(
- std::async(std::launch::async, [this]{io_service_.run();})
- );
+ std::async(std::launch::async, [this]{
+ auto& timer_queue = detail::dumb_timer_queue::get_current_dumb_timer_queue();
+ timer_queue.set_io_service(io_service_);
+ while(!io_service_.stopped())
+ {
+ timer_queue.process();
+ io_service_.poll_one();
+ }
+ }));
CROW_LOG_INFO << server_name_ << " server is running, local port " << port_;