Skip to content

Commit

Permalink
Add stack dump before throwing object::unlock bug exception.
Browse files Browse the repository at this point in the history
  • Loading branch information
ymmt2005 committed Nov 18, 2013
1 parent b8d8291 commit 43a3f90
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
#include "stats.hpp"
#include "tempfile.hpp"

#include <cybozu/util.hpp>

#include <cstddef>
#include <cstdint>
#include <ctime>
#include <memory>
#include <stdexcept>
#include <string>
#include <vector>

namespace yrmcds {
Expand Down Expand Up @@ -97,8 +100,13 @@ class object {
}

void unlock(bool force = false) {
if( ! force && ! locked_by_self() )
throw std::logic_error("object::unlock bug");
if( ! force && ! locked_by_self() ) {
cybozu::dump_stack();
throw std::logic_error("object::unlock bug (m_lock=" +
std::to_string(m_lock) +
", g_context=" +
std::to_string(g_context) + ")");
}
m_lock = -1;
}

Expand Down

0 comments on commit 43a3f90

Please sign in to comment.