diff options
Diffstat (limited to '')
-rw-r--r-- | src/common/AsyncOpTracker.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/common/AsyncOpTracker.h b/src/common/AsyncOpTracker.h new file mode 100644 index 00000000..d913032a --- /dev/null +++ b/src/common/AsyncOpTracker.h @@ -0,0 +1,30 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#ifndef CEPH_ASYNC_OP_TRACKER_H +#define CEPH_ASYNC_OP_TRACKER_H + +#include "common/ceph_mutex.h" + +struct Context; + +class AsyncOpTracker { +public: + AsyncOpTracker(); + ~AsyncOpTracker(); + + void start_op(); + void finish_op(); + + void wait_for_ops(Context *on_finish); + + bool empty(); + +private: + ceph::mutex m_lock = ceph::make_mutex("AsyncOpTracker::m_lock"); + uint32_t m_pending_ops = 0; + Context *m_on_finish = nullptr; + +}; + +#endif // CEPH_ASYNC_OP_TRACKER_H |