Use std::atomic for close_state.
This commit is contained in:
parent
939f4fa9fd
commit
af8042dc61
@ -18,7 +18,7 @@ SqliteConnectionSafe::SqliteConnectionSafe(string path, DbKey key, optional<int3
|
||||
cipher_version = std::move(cipher_version)] {
|
||||
auto r_db = SqliteDb::open_with_key(path, false, key, cipher_version.copy());
|
||||
if (r_db.is_error()) {
|
||||
LOG(FATAL) << "Can't open database in state " << *close_state_ptr << ": " << r_db.error().message();
|
||||
LOG(FATAL) << "Can't open database in state " << close_state_ptr->load() << ": " << r_db.error().message();
|
||||
}
|
||||
auto db = r_db.move_as_ok();
|
||||
db.exec("PRAGMA journal_mode=WAL").ensure();
|
||||
|
@ -14,6 +14,8 @@
|
||||
#include "td/utils/common.h"
|
||||
#include "td/utils/optional.h"
|
||||
|
||||
#include <atomic>
|
||||
|
||||
namespace td {
|
||||
|
||||
class SqliteConnectionSafe {
|
||||
@ -30,7 +32,7 @@ class SqliteConnectionSafe {
|
||||
|
||||
private:
|
||||
string path_;
|
||||
uint32 close_state_ = 0;
|
||||
std::atomic<uint32> close_state_ = 0;
|
||||
LazySchedulerLocalStorage<SqliteDb> lsls_connection_;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user