summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@inktank.com>2013-10-03 11:49:33 -0700
committerYehuda Sadeh <yehuda@inktank.com>2013-10-11 14:53:25 -0700
commit7ef5eb06ec07d4e7c3fee4d85de8a8310f7ed94f (patch)
treed31c6d490f959f23cb122b3f74c3d4bb47d7d3c8
parentb032931dc760f2a9baa7879f422caf8d9281e6c4 (diff)
downloadceph-7ef5eb06ec07d4e7c3fee4d85de8a8310f7ed94f.tar.gz
librados: drop reference to completion in container destructor
Move the PoolAsyncCompletionImpl reference drop from C_PoolAsync_Safe::finish() to ~C_PoolAsyncSafe(), as finish() is only called when the async request is actually sent. Signed-off-by: Yehuda Sadeh <yehuda@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
-rw-r--r--src/librados/PoolAsyncCompletionImpl.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/librados/PoolAsyncCompletionImpl.h b/src/librados/PoolAsyncCompletionImpl.h
index efb89641466..443b2c23a17 100644
--- a/src/librados/PoolAsyncCompletionImpl.h
+++ b/src/librados/PoolAsyncCompletionImpl.h
@@ -94,6 +94,9 @@ namespace librados {
C_PoolAsync_Safe(PoolAsyncCompletionImpl *_c) : c(_c) {
c->get();
}
+ ~C_PoolAsync_Safe() {
+ c->put();
+ }
void finish(int r) {
c->lock.Lock();
@@ -109,7 +112,7 @@ namespace librados {
c->lock.Lock();
}
- c->put_unlock();
+ c->lock.Unlock();
}
};
}