@@ -13931,12 +13931,12 @@ namespace sqlite_orm {
13931
13931
_onAfterOpen{std::move(onAfterOpen)} {}
13932
13932
13933
13933
void retain() {
13934
- const maybe_lock maybeLock{this-> _sync, !this-> _openedForeverHint};
13934
+ const maybe_lock maybeLock{_sync, !_openedForeverHint};
13935
13935
13936
13936
// `maybeLock.isSynced`: the lock above already synchronized everything, so we can just atomically increment the counter
13937
13937
// `!maybeLock.isSynced`: we presume that the connection is opened once in a single-threaded context [also open forever].
13938
13938
// therefore we can just use an atomic increment but don't need sequencing due to `prevCount > 0`.
13939
- if (int prevCount = this-> _retain_count.fetch_add(1, std::memory_order_relaxed); prevCount > 0) {
13939
+ if (int prevCount = _retain_count.fetch_add(1, std::memory_order_relaxed); prevCount > 0) {
13940
13940
return;
13941
13941
}
13942
13942
@@ -13947,15 +13947,15 @@ namespace sqlite_orm {
13947
13947
throw_translated_sqlite_error(this->db);
13948
13948
}
13949
13949
13950
- if (this-> _onAfterOpen) {
13951
- this-> _onAfterOpen(this->db);
13950
+ if (_onAfterOpen) {
13951
+ _onAfterOpen(this->db);
13952
13952
}
13953
13953
}
13954
13954
13955
13955
void release() {
13956
- const maybe_lock maybeLock{this-> _sync, !this-> _openedForeverHint};
13956
+ const maybe_lock maybeLock{_sync, !_openedForeverHint};
13957
13957
13958
- if (int prevCount = this-> _retain_count.fetch_sub(
13958
+ if (int prevCount = _retain_count.fetch_sub(
13959
13959
1,
13960
13960
maybeLock.isSynced
13961
13961
// the lock above already synchronized everything, so we can just atomically decrement the counter
@@ -13984,7 +13984,7 @@ namespace sqlite_orm {
13984
13984
* @attention While retrieving the reference count value is atomic it makes only sense at single-threaded points in code.
13985
13985
*/
13986
13986
int retain_count() const {
13987
- return this-> _retain_count.load(std::memory_order_relaxed);
13987
+ return _retain_count.load(std::memory_order_relaxed);
13988
13988
}
13989
13989
13990
13990
const std::string filename;
@@ -14013,22 +14013,22 @@ namespace sqlite_orm {
14013
14013
// first one opens the connection.
14014
14014
// we presume that the connection is opened once in a single-threaded context [also open forever].
14015
14015
// therefore we can just use an atomic increment but don't need sequencing due to `prevCount > 0`.
14016
- if (this-> _retain_count.fetch_add(1, std::memory_order_relaxed) == 0) {
14016
+ if (_retain_count.fetch_add(1, std::memory_order_relaxed) == 0) {
14017
14017
int rc = sqlite3_open(this->filename.c_str(), &this->db);
14018
14018
if (rc != SQLITE_OK) SQLITE_ORM_CPP_UNLIKELY /*possible, but unexpected*/ {
14019
14019
throw_translated_sqlite_error(this->db);
14020
14020
}
14021
14021
}
14022
14022
14023
- if (this-> _onAfterOpen) {
14024
- this-> _onAfterOpen(this->db);
14023
+ if (_onAfterOpen) {
14024
+ _onAfterOpen(this->db);
14025
14025
}
14026
14026
}
14027
14027
14028
14028
void release() {
14029
14029
// last one closes the connection.
14030
14030
// we assume that this might happen by any thread, therefore the counter must serve as a synchronization point.
14031
- if (this-> _retain_count.fetch_sub(1, std::memory_order_acq_rel) == 1) {
14031
+ if (_retain_count.fetch_sub(1, std::memory_order_acq_rel) == 1) {
14032
14032
int rc = sqlite3_close(this->db);
14033
14033
if (rc != SQLITE_OK) SQLITE_ORM_CPP_UNLIKELY {
14034
14034
throw_translated_sqlite_error(this->db);
@@ -14047,7 +14047,7 @@ namespace sqlite_orm {
14047
14047
* @attention While retrieving the reference count value is atomic it makes only sense at single-threaded points in code.
14048
14048
*/
14049
14049
int retain_count() const {
14050
- return this-> _retain_count.load(std::memory_order_relaxed);
14050
+ return _retain_count.load(std::memory_order_relaxed);
14051
14051
}
14052
14052
14053
14053
const std::string filename;
0 commit comments