Skip to content

Commit fdedca4

Browse files
committed
Attempt to fix sqlite mutexes.
1 parent fe13720 commit fdedca4

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

src/common/project.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ void Patch::patchSources(const Files &files) const
359359
regex_prepared.emplace_back(std::regex(p.first), p.second);
360360
for (auto &f : files)
361361
{
362-
auto s = read_file(f, true);
362+
auto s = read_file(f);
363363
for (auto &p : replace)
364364
boost::algorithm::replace_all(s, p.first, p.second);
365365
for (auto &p : regex_prepared)
@@ -1337,7 +1337,7 @@ void Project::prepareExports() const
13371337
/*auto &srcs = getSources();
13381338
for (auto &f : srcs)
13391339
{
1340-
auto s = read_file(f, true);
1340+
auto s = read_file(f);
13411341
13421342
boost::algorithm::replace_all(s, CPPAN_EXPORT, api);
13431343

src/common/sqlite_database.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ sqlite3 *load_from_file(const path &fn, bool read_only)
102102
sqlite3 *db = nullptr;
103103
bool ok = true;
104104
int flags = 0;
105-
if (sqlite3_threadsafe())
106-
flags |= SQLITE_OPEN_NOMUTEX;// SQLITE_OPEN_FULLMUTEX;
105+
//if (sqlite3_threadsafe())
106+
flags |= SQLITE_OPEN_FULLMUTEX;
107107
if (read_only)
108108
flags |= SQLITE_OPEN_READONLY;
109109
else
@@ -116,6 +116,7 @@ sqlite3 *load_from_file(const path &fn, bool read_only)
116116
sqlite3_close(db);
117117
throw std::runtime_error(error);
118118
}
119+
sqlite3_busy_timeout(db, 60000);
119120
return db;
120121
}
121122

@@ -231,8 +232,8 @@ bool SqliteDatabase::execute(String sql, void *object, Sqlite3Callback callback,
231232
boost::trim(sql);
232233

233234
// TODO: remove later when sqlite won't be crashing
234-
static std::mutex m;
235-
std::unique_lock<std::mutex> lk(m);
235+
//static std::mutex m;
236+
//std::unique_lock<std::mutex> lk(m);
236237

237238
// lock always for now
238239
ScopedFileLock lock(get_lock(fullName), std::defer_lock);
@@ -269,8 +270,8 @@ bool SqliteDatabase::execute(String sql, DatabaseCallback callback, bool nothrow
269270
boost::trim(sql);
270271

271272
// TODO: remove later when sqlite won't be crashing
272-
static std::mutex m;
273-
std::unique_lock<std::mutex> lk(m);
273+
//static std::mutex m;
274+
//std::unique_lock<std::mutex> lk(m);
274275

275276
// lock always for now
276277
ScopedFileLock lock(get_lock(fullName), std::defer_lock);

0 commit comments

Comments
 (0)