aboutsummaryrefslogtreecommitdiffstats
path: root/include/http_server.h
diff options
context:
space:
mode:
authoripknHama <ipknhama@gmail.com>2015-05-27 14:47:51 -0400
committeripknHama <ipknhama@gmail.com>2015-05-27 14:47:51 -0400
commit5b72a099736faca57ff2e2906bb1912ed29498d0 (patch)
tree430bbc5adb0fc8156a86979a390ee2b86237bace /include/http_server.h
parent4f5e36f9274cec4f984529ddc7576991a82ab379 (diff)
downloadcrow-5b72a099736faca57ff2e2906bb1912ed29498d0.tar.gz
crow-5b72a099736faca57ff2e2906bb1912ed29498d0.zip
fix multithread bug occurs while accepting new connection
Diffstat (limited to 'include/http_server.h')
-rw-r--r--include/http_server.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/http_server.h b/include/http_server.h
index e7d9f4f..143b58d 100644
--- a/include/http_server.h
+++ b/include/http_server.h
@@ -142,11 +142,14 @@ namespace crow
get_cached_date_str_pool_[roundrobin_index_], *timer_queue_pool_[roundrobin_index_]
);
acceptor_.async_accept(p->socket(),
- [this, p](boost::system::error_code ec)
+ [this, p, &is](boost::system::error_code ec)
{
if (!ec)
{
- p->start();
+ is.post([p]
+ {
+ p->start();
+ });
}
do_accept();
});