AsyncLoop: Add auto-incrementing & completion testing methods
These basically make it almost impossible to commit errors in async loop logic implementation.
This commit is contained in:
@@ -18,6 +18,20 @@ public:
|
||||
return nSucceeded + nFailed == nTotal;
|
||||
}
|
||||
|
||||
void incrementSuccessOrFailureDueTo(bool success)
|
||||
{
|
||||
if (success)
|
||||
{ ++nSucceeded; }
|
||||
else
|
||||
{ ++nFailed; }
|
||||
}
|
||||
|
||||
bool incrementSuccessOrFailureAndTestForCompletionDueTo(bool success)
|
||||
{
|
||||
incrementSuccessOrFailureDueTo(success);
|
||||
return isComplete();
|
||||
}
|
||||
|
||||
public:
|
||||
std::atomic<unsigned int> nTotal, nSucceeded, nFailed;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user