diff --git a/include/asynchronousLoop.h b/include/asynchronousLoop.h index 412fbcb..2f5a685 100644 --- a/include/asynchronousLoop.h +++ b/include/asynchronousLoop.h @@ -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 nSucceeded, nFailed; };