1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Add a mutex to the sqlite3_db_config() interface so that it is threadsafe

when two or more threads call it on the same database connection at the same
time.

FossilOrigin-Name: 459ad8846ee1ee2d3b277a291c47121692bdf477e779b06e77be8338f62237a6
This commit is contained in:
drh
2022-08-24 17:59:00 +00:00
parent 2ce2b779bb
commit 7383f5a7d9
3 changed files with 10 additions and 8 deletions

View File

@@ -915,6 +915,7 @@ int sqlite3_db_cacheflush(sqlite3 *db){
int sqlite3_db_config(sqlite3 *db, int op, ...){
va_list ap;
int rc;
sqlite3_mutex_enter(db->mutex);
va_start(ap, op);
switch( op ){
case SQLITE_DBCONFIG_MAINDBNAME: {
@@ -980,6 +981,7 @@ int sqlite3_db_config(sqlite3 *db, int op, ...){
}
}
va_end(ap);
sqlite3_mutex_leave(db->mutex);
return rc;
}