mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-02 00:14:14 +08:00
mdbx++: refine abort/commit.
More for https://github.com/erthink/libmdbx/pull/143 Change-Id: I07de4c43d039f904495f0f4caf586d8764174dcf
This commit is contained in:
parent
5c693ccd96
commit
a987301204
2
.github/actions/spelling/expect.txt
vendored
2
.github/actions/spelling/expect.txt
vendored
@ -137,6 +137,7 @@ calloc
|
|||||||
cas
|
cas
|
||||||
casename
|
casename
|
||||||
cassert
|
cassert
|
||||||
|
castis
|
||||||
castortech
|
castortech
|
||||||
cattr
|
cattr
|
||||||
cbegin
|
cbegin
|
||||||
@ -1390,6 +1391,7 @@ rw
|
|||||||
samedata
|
samedata
|
||||||
samelength
|
samelength
|
||||||
SAMSUNG
|
SAMSUNG
|
||||||
|
sasgas
|
||||||
savailable
|
savailable
|
||||||
scalability
|
scalability
|
||||||
sched
|
sched
|
||||||
|
16
src/mdbx.c++
16
src/mdbx.c++
@ -1314,22 +1314,18 @@ txn_managed::~txn_managed() noexcept {
|
|||||||
|
|
||||||
void txn_managed::abort() {
|
void txn_managed::abort() {
|
||||||
const error err = static_cast<MDBX_error_t>(::mdbx_txn_abort(handle_));
|
const error err = static_cast<MDBX_error_t>(::mdbx_txn_abort(handle_));
|
||||||
if (MDBX_UNLIKELY(err.code() != MDBX_SUCCESS)) {
|
if (MDBX_LIKELY(err.code() != MDBX_THREAD_MISMATCH))
|
||||||
if (err.code() != MDBX_THREAD_MISMATCH)
|
handle_ = nullptr;
|
||||||
handle_ = nullptr;
|
if (MDBX_UNLIKELY(err.code() != MDBX_SUCCESS))
|
||||||
err.throw_exception();
|
err.throw_exception();
|
||||||
}
|
|
||||||
handle_ = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void txn_managed::commit() {
|
void txn_managed::commit() {
|
||||||
const error err = static_cast<MDBX_error_t>(::mdbx_txn_commit(handle_));
|
const error err = static_cast<MDBX_error_t>(::mdbx_txn_commit(handle_));
|
||||||
if (MDBX_UNLIKELY(err.code() != MDBX_SUCCESS)) {
|
if (MDBX_LIKELY(err.code() != MDBX_THREAD_MISMATCH))
|
||||||
if (err.code() != MDBX_THREAD_MISMATCH)
|
handle_ = nullptr;
|
||||||
handle_ = nullptr;
|
if (MDBX_UNLIKELY(err.code() != MDBX_SUCCESS))
|
||||||
err.throw_exception();
|
err.throw_exception();
|
||||||
}
|
|
||||||
handle_ = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user