AsyncLoop: Add copy constr + assignment op

Make nTotal non-const.
This commit is contained in:
2025-09-16 18:20:08 -04:00
parent 429bd2a349
commit 5d30941aab
+17 -1
View File
@@ -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;
};