diff --git a/src_main/concurrent/piblockingdequeue.h b/src_main/concurrent/piblockingdequeue.h index 3396e5a5..d7ed9f98 100644 --- a/src_main/concurrent/piblockingdequeue.h +++ b/src_main/concurrent/piblockingdequeue.h @@ -41,7 +41,8 @@ public: mutex.unlock(); other.mutex.unlock(); } - virtual ~PIBlockingDequeue() { + + ~PIBlockingDequeue() { delete cond_var_add; delete cond_var_rem; } @@ -51,7 +52,7 @@ public: * * @param v the element to add */ - virtual void put(const T & v) { + void put(const T & v) { mutex.lock(); cond_var_rem->wait(mutex, [&]() { return PIDeque::size() < max_size; }); PIDeque::push_back(v); @@ -66,7 +67,7 @@ public: * @param v the element to add * @return true if the element was added to this queue, else false */ - virtual bool offer(const T & v) { + bool offer(const T & v) { mutex.lock(); if (PIDeque::size() >= max_size) { mutex.unlock(); @@ -86,7 +87,7 @@ public: * @param timeoutMs how long to wait before giving up, in milliseconds * @return true if successful, or false if the specified waiting time elapses before space is available */ - virtual bool offer(const T & v, int timeoutMs) { + bool offer(const T & v, int timeoutMs) { mutex.lock(); bool isOk = cond_var_rem->waitFor(mutex, timeoutMs, [&]() { return PIDeque::size() < max_size; } ); if (isOk) PIDeque::push_back(v); @@ -100,7 +101,7 @@ public: * * @return the head of this queue */ - virtual T take() { + T take() { T t; mutex.lock(); cond_var_add->wait(mutex, [&]() { return !PIDeque::isEmpty(); }); @@ -118,7 +119,7 @@ public: * @param defaultVal value, which returns if the specified waiting time elapses before an element is available * @return the head of this queue, or defaultVal if the specified waiting time elapses before an element is available */ - virtual T poll(int timeoutMs, const T & defaultVal) { + T poll(int timeoutMs, const T & defaultVal) { T t; mutex.lock(); bool isOk = cond_var_add->waitFor(mutex, timeoutMs, [&]() { return !PIDeque::isEmpty(); }); @@ -134,7 +135,7 @@ public: * * @return the capacity */ - virtual size_t capacity() { + size_t capacity() { size_t c; mutex.lock(); c = max_size; @@ -148,7 +149,7 @@ public: * * @return the remaining capacity */ - virtual size_t remainingCapacity() { + size_t remainingCapacity() { mutex.lock(); size_t c = max_size - PIDeque::size(); mutex.unlock(); @@ -158,7 +159,7 @@ public: /** * @brief Returns the number of elements in this collection. */ - virtual size_t size() { + size_t size() { mutex.lock(); size_t s = PIDeque::size(); mutex.unlock(); @@ -168,7 +169,7 @@ public: /** * @brief Removes all available elements from this queue and adds them to other given queue. */ - virtual size_t drainTo(PIDeque& other, size_t maxCount = SIZE_MAX) { + size_t drainTo(PIDeque& other, size_t maxCount = SIZE_MAX) { mutex.lock(); size_t count = maxCount > PIDeque::size() ? PIDeque::size() : maxCount; for (size_t i = 0; i < count; ++i) other.push_back(PIDeque::take_front()); @@ -179,7 +180,7 @@ public: /** * @brief Removes all available elements from this queue and adds them to other given queue. */ - virtual size_t drainTo(PIBlockingDequeue& other, size_t maxCount = SIZE_MAX) { + size_t drainTo(PIBlockingDequeue& other, size_t maxCount = SIZE_MAX) { mutex.lock(); other.mutex.lock(); size_t count = maxCount > PIDeque::size() ? PIDeque::size() : maxCount; diff --git a/src_main/concurrent/piconditionlock.h b/src_main/concurrent/piconditionlock.h index 88452844..caafb810 100644 --- a/src_main/concurrent/piconditionlock.h +++ b/src_main/concurrent/piconditionlock.h @@ -10,7 +10,7 @@ class PIP_EXPORT PIConditionLock { public: explicit PIConditionLock(); - virtual ~PIConditionLock(); + ~PIConditionLock(); //! \brief lock void lock(); diff --git a/src_main/concurrent/piconditionvar.h b/src_main/concurrent/piconditionvar.h index b51124e6..cef1f9f4 100644 --- a/src_main/concurrent/piconditionvar.h +++ b/src_main/concurrent/piconditionvar.h @@ -15,24 +15,24 @@ class PIP_EXPORT PIConditionVariable { public: explicit PIConditionVariable(); - virtual ~PIConditionVariable(); + ~PIConditionVariable(); /** * @brief Unblocks one of the threads currently waiting for this condition. If no threads are waiting, the function * does nothing. If more than one, it is unspecified which of the threads is selected. */ - virtual void notifyOne(); + void notifyOne(); /** * @brief Unblocks all threads currently waiting for this condition. If no threads are waiting, the function does * nothing. */ - virtual void notifyAll(); + void notifyAll(); /** * @brief see wait(PIConditionLock&, const std::function&) */ - virtual void wait(PIConditionLock& lk); + void wait(PIConditionLock& lk); /** * @brief Wait until notified @@ -58,12 +58,12 @@ public: * @param condition A callable object or function that takes no arguments and returns a value that can be evaluated * as a bool. This is called repeatedly until it evaluates to true. */ - virtual void wait(PIConditionLock& lk, const std::function& condition); + void wait(PIConditionLock& lk, const std::function& condition); /** * @brief see waitFor(PIConditionLock&, int, const std::function&) */ - virtual bool waitFor(PIConditionLock& lk, int timeoutMs); + bool waitFor(PIConditionLock& lk, int timeoutMs); /** * @brief Wait for timeout or until notified @@ -90,7 +90,7 @@ public: * as a bool. This is called repeatedly until it evaluates to true. * @return false if timeout reached or true if wakeup condition is true */ - virtual bool waitFor(PIConditionLock& lk, int timeoutMs, const std::function& condition); + bool waitFor(PIConditionLock& lk, int timeoutMs, const std::function& condition); private: NO_COPY_CLASS(PIConditionVariable)