mirror of
https://github.com/XRPLF/clio.git
synced 2026-06-04 01:06:45 +00:00
@@ -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_;
|
||||
|
||||
Reference in New Issue
Block a user