AsyncLoop: Add copy constr + assignment op
Make nTotal non-const.
This commit is contained in:
@@ -14,6 +14,22 @@ public:
|
||||
: nTotal(nTotal), nSucceeded(nSucceeded), nFailed(nFailed)
|
||||
{}
|
||||
|
||||
AsynchronousLoop(const AsynchronousLoop& other)
|
||||
: nTotal(other.nTotal),
|
||||
nSucceeded(other.nSucceeded.load()), nFailed(other.nFailed.load())
|
||||
{}
|
||||
|
||||
AsynchronousLoop& operator=(const AsynchronousLoop& other)
|
||||
{
|
||||
if (this != &other)
|
||||
{
|
||||
nTotal = other.nTotal;
|
||||
nSucceeded.store(other.nSucceeded.load());
|
||||
nFailed.store(other.nFailed.load());
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool isComplete(void) const
|
||||
{
|
||||
return nSucceeded + nFailed == nTotal;
|
||||
@@ -39,7 +55,7 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
const unsigned int nTotal;
|
||||
unsigned int nTotal;
|
||||
std::atomic<unsigned int> nSucceeded, nFailed;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user