1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #ifndef LIBRBD_IO_ASYNC_OPERATION_H
5 #define LIBRBD_IO_ASYNC_OPERATION_H
7 #include "include/assert.h"
8 #include "include/xlist.h"
19 class AsyncOperation {
23 : m_image_ctx(NULL), m_xlist_item(this)
29 assert(!m_xlist_item.is_on_list());
32 inline bool started() const {
33 return m_xlist_item.is_on_list();
36 void start_op(ImageCtx &image_ctx);
39 void add_flush_context(Context *on_finish);
43 ImageCtx *m_image_ctx;
44 xlist<AsyncOperation *>::item m_xlist_item;
45 std::list<Context *> m_flush_contexts;
52 #endif // LIBRBD_IO_ASYNC_OPERATION_H