Async: add AsyncLoop bounds tracker
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#ifndef ASYNCHRONOUS_LOOP_H
|
||||
#define ASYNCHRONOUS_LOOP_H
|
||||
|
||||
#include <atomic>
|
||||
|
||||
namespace smo {
|
||||
|
||||
class AsynchronousLoop
|
||||
{
|
||||
public:
|
||||
AsynchronousLoop(
|
||||
unsigned int nTotal, unsigned int nSucceeded=0, unsigned int nFailed=0)
|
||||
: nTotal(nTotal), nSucceeded(nSucceeded), nFailed(nFailed)
|
||||
{
|
||||
}
|
||||
|
||||
~AsynchronousLoop(void);
|
||||
|
||||
bool isComplete(void) const
|
||||
{
|
||||
return nSucceeded + nFailed == nTotal;
|
||||
}
|
||||
|
||||
public:
|
||||
std::atomic<unsigned int> nTotal, nSucceeded, nFailed;
|
||||
};
|
||||
|
||||
} // namespace smo
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user