fix: Fix issues clang-tidy found (#1708)

Fixes #1706.
This commit is contained in:
Sergey Kuznetsov
2024-10-25 11:48:18 +01:00
committed by GitHub
parent 2a5d73730f
commit c62e9d56b8
5 changed files with 45 additions and 15 deletions

View File

@@ -41,10 +41,16 @@ CoroutineGroup::~CoroutineGroup()
ASSERT(childrenCounter_ == 0, "CoroutineGroup is destroyed without waiting for child coroutines to finish");
}
bool
CoroutineGroup::canSpawn() const
{
return not maxChildren_.has_value() or childrenCounter_ < *maxChildren_;
}
bool
CoroutineGroup::spawn(boost::asio::yield_context yield, std::function<void(boost::asio::yield_context)> fn)
{
if (maxChildren_.has_value() && childrenCounter_ >= *maxChildren_)
if (not canSpawn())
return false;
++childrenCounter_;