From 5605d7d351d8949d46087d2f193ef9a51c209a71 Mon Sep 17 00:00:00 2001 From: An Tao Date: Tue, 1 Oct 2019 01:40:22 +0800 Subject: [PATCH] Fix a error in setThreadNum method (#263) --- lib/src/HttpAppFrameworkImpl.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/src/HttpAppFrameworkImpl.cc b/lib/src/HttpAppFrameworkImpl.cc index cbc99af3..97c24436 100644 --- a/lib/src/HttpAppFrameworkImpl.cc +++ b/lib/src/HttpAppFrameworkImpl.cc @@ -225,7 +225,11 @@ void HttpAppFrameworkImpl::registerHttpController( } HttpAppFramework &HttpAppFrameworkImpl::setThreadNum(size_t threadNum) { - assert(threadNum >= 1); + if (threadNum == 0) + { + _threadNum = std::thread::hardware_concurrency(); + return *this; + } _threadNum = threadNum; return *this; }