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

@ -1,5 +1,5 @@
C Fix\san\sinefficiency\sin\sthe\s".dump"\scommand\swhen\soutputing\slarge\sblob\sliterals.
D 2022-08-24T11:51:31.345
C Add\sa\smutex\sto\sthe\ssqlite3_db_config()\sinterface\sso\sthat\sit\sis\sthreadsafe\nwhen\stwo\sor\smore\sthreads\scall\sit\son\sthe\ssame\sdatabase\sconnection\sat\sthe\ssame\ntime.
D 2022-08-24T17:59:00.857
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -552,7 +552,7 @@ F src/insert.c aea5361767817f917b0f0f647a1f0b1621bd858938ae6ae545c3b6b9814b798f
F src/json.c 7749b98c62f691697c7ee536b570c744c0583cab4a89200fdd0fc2aa8cc8cbd6
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
F src/loadext.c 853385cc7a604157e137585097949252d5d0c731768e16b044608e5c95c3614b
F src/main.c 211f5fd4110b0565fc2135d60ed12b4ef8a29d634414f471b5f957aa7b7f2afa
F src/main.c 8983b4a316d7e09946dd731913aa41712f02e2b55cb5c6c92126ccfe2473244a
F src/malloc.c b7a3430cbe91d3e8e04fc10c2041b3a19794e63556ad2441a13d8dadd9b2bafc
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c c12a42539b1ba105e3707d0e628ad70e611040d8f5e38cf942cee30c867083de
@ -1999,8 +1999,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 34b8ea31877ae8b40729d37b3f51ae7e15f38be841881ea4a37c9c8f0a52896d
R dc24309269ebb0196ddc57abadbebde7
U dan
Z dc08be03d0061be2657759d58bd54896
P c055d05dbdfd4643d5052c6e6a736c78651fdfcd78f15f791af903df3814832d
R ffd7ba0b6070375035a4339c90c0b447
U drh
Z c6fbe2adc7008df263b408289cea2842
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
c055d05dbdfd4643d5052c6e6a736c78651fdfcd78f15f791af903df3814832d
459ad8846ee1ee2d3b277a291c47121692bdf477e779b06e77be8338f62237a6

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;
}