Allow the client of SimpleThrottle to detect an async error
so that it can exit early.
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit
b88b88c5df91325fb713c2031a56bffe421268e0)
m_cond.Signal();
}
+bool SimpleThrottle::pending_error() const
+{
+ Mutex::Locker l(m_lock);
+ return (m_ret < 0);
+}
+
int SimpleThrottle::wait_for_ret()
{
Mutex::Locker l(m_lock);
~SimpleThrottle();
void start_op();
void end_op(int r);
+ bool pending_error() const;
int wait_for_ret();
private:
- Mutex m_lock;
+ mutable Mutex m_lock;
Cond m_cond;
uint64_t m_max;
uint64_t m_current;