1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 * Ceph - scalable distributed file system
6 * Copyright (C) 2004-2012 Sage Weil <sage@newdream.net>
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
15 #ifndef CEPH_LIBRADOS_POOLASYNCCOMPLETIONIMPL_H
16 #define CEPH_LIBRADOS_POOLASYNCCOMPLETIONIMPL_H
18 #include "common/Cond.h"
19 #include "common/Mutex.h"
20 #include "include/Context.h"
21 #include "include/rados/librados.h"
22 #include "include/rados/librados.hpp"
25 struct PoolAsyncCompletionImpl
{
32 rados_callback_t callback
;
35 PoolAsyncCompletionImpl() : lock("PoolAsyncCompletionImpl lock"),
36 ref(1), rval(0), released(false), done(false),
37 callback(0), callback_arg(0) {}
39 int set_callback(void *cb_arg
, rados_callback_t cb
) {
42 callback_arg
= cb_arg
;
59 int get_return_value() {
90 class C_PoolAsync_Safe
: public Context
{
91 PoolAsyncCompletionImpl
*c
;
94 explicit C_PoolAsync_Safe(PoolAsyncCompletionImpl
*_c
) : c(_c
) {
97 ~C_PoolAsync_Safe() override
{
101 void finish(int r
) override
{
108 rados_callback_t cb
= c
->callback
;
109 void *cb_arg
= c
->callback_arg
;