Skip to content

Commit f5de41f

Browse files
authored
Make quit function thread safe (#2247)
1 parent a3b4779 commit f5de41f

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/src/HttpAppFrameworkImpl.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,7 @@ HttpAppFramework &HttpAppFrameworkImpl::createRedisClient(
10331033

10341034
void HttpAppFrameworkImpl::quit()
10351035
{
1036-
if (getLoop()->isRunning())
1036+
if (getLoop()->isRunning() && running_.exchange(false))
10371037
{
10381038
getLoop()->queueInLoop([this]() {
10391039
// Release members in the reverse order of initialization
@@ -1044,7 +1044,6 @@ void HttpAppFrameworkImpl::quit()
10441044
pluginsManagerPtr_.reset();
10451045
redisClientManagerPtr_.reset();
10461046
dbClientManagerPtr_.reset();
1047-
running_ = false;
10481047
getLoop()->quit();
10491048
for (trantor::EventLoop *loop : ioLoopThreadPool_->getLoops())
10501049
{

0 commit comments

Comments
 (0)