1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3
4 #include "common/AsyncOpTracker.h"
5 #include "include/Context.h"
6
7 AsyncOpTracker::AsyncOpTracker()
8 {
9 }
10
(1) Event exn_spec_violation: |
An exception of type "_ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINSt8ios_base7failureB5cxx11EEEEE" is thrown but the throw list "throw()" doesn't allow it to be thrown. This will cause a call to unexpected() which usually calls terminate(). |
Also see events: |
[fun_call_w_exception] |
11 AsyncOpTracker::~AsyncOpTracker() {
12 std::lock_guard locker(m_lock);
(2) Event fun_call_w_exception: |
Called function throws an exception of type "_ZN5boost16exception_detail10clone_implINS0_19error_info_injectorINSt8ios_base7failureB5cxx11EEEEE". [details] |
Also see events: |
[exn_spec_violation] |
13 ceph_assert(m_pending_ops == 0);
14 }
15
16 void AsyncOpTracker::start_op() {
17 std::lock_guard locker(m_lock);
18 ++m_pending_ops;
19 }
20
21 void AsyncOpTracker::finish_op() {
22 Context *on_finish = nullptr;
23 {
24 std::lock_guard locker(m_lock);
25 ceph_assert(m_pending_ops > 0);
26 if (--m_pending_ops == 0) {
27 std::swap(on_finish, m_on_finish);
28 }
29 }
30
31 if (on_finish != nullptr) {
32 on_finish->complete(0);
33 }
34 }
35
36 void AsyncOpTracker::wait_for_ops(Context *on_finish) {
37 {
38 std::lock_guard locker(m_lock);
39 ceph_assert(m_on_finish == nullptr);
40 if (m_pending_ops > 0) {
41 m_on_finish = on_finish;
42 return;
43 }
44 }
45 on_finish->complete(0);
46 }
47
48 bool AsyncOpTracker::empty() {
49 std::lock_guard locker(m_lock);
50 return (m_pending_ops == 0);
51 }
52
53