in dispenso/task_set.cpp [100:116]
bool TaskSet::tryWait(size_t maxToExecute) {
while (outstandingTaskCount_.load(std::memory_order_acquire) && maxToExecute--) {
if (!pool_.tryExecuteNextFromProducerToken(token_)) {
break;
}
}
// Must check completion prior to checking exceptions, otherwise there could be a case where
// exceptions are checked, then an exception is propagated, and then we return whether all items
// have been completed, thus dropping the exception.
if (outstandingTaskCount_.load(std::memory_order_acquire)) {
return false;
}
testAndResetException();
return true;
}