mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Changes to debugging code in mutex_unix.c and mutex_w32.c to make an assert() statement threadsafe.
FossilOrigin-Name: e82e32bd431ccacd276df8241592eb5519d87122
This commit is contained in:
16
manifest
16
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Fix\stypos\sin\scomments.\s\sNo\sfunctional\schanges\sto\sthe\scode.
|
C Changes\sto\sdebugging\scode\sin\smutex_unix.c\sand\smutex_w32.c\sto\smake\san\sassert()\sstatement\sthreadsafe.
|
||||||
D 2010-08-09T15:44:21
|
D 2010-08-10T07:12:27
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e
|
F Makefile.in ec08dc838fd8110fe24c92e5130bcd91cbb1ff2e
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
@@ -147,8 +147,8 @@ F src/mutex.c 6949180803ff05a7d0e2b9334a95b4fb5a00e23f
|
|||||||
F src/mutex.h 6fde601e55fa6c3fae768783c439797ab84c87c6
|
F src/mutex.h 6fde601e55fa6c3fae768783c439797ab84c87c6
|
||||||
F src/mutex_noop.c d5cfbca87168c661a0b118cd8e329a908e453151
|
F src/mutex_noop.c d5cfbca87168c661a0b118cd8e329a908e453151
|
||||||
F src/mutex_os2.c 6a62583e374ba3ac1a3fcc0da2bfdac7d3942689
|
F src/mutex_os2.c 6a62583e374ba3ac1a3fcc0da2bfdac7d3942689
|
||||||
F src/mutex_unix.c cf84466b4fdd2baa0d5a10bb19f08b2abc1ce42e
|
F src/mutex_unix.c abb8c98a6c27c57280e71522d059e929c708d019
|
||||||
F src/mutex_w32.c 1fe0e735897be20e09dd6f53c3fb516c6b48c0eb
|
F src/mutex_w32.c b7ed3366a1d44a62a17d4eaefdaa2e7c25f944c2
|
||||||
F src/notify.c 976dd0f6171d4588e89e874fcc765e92914b6d30
|
F src/notify.c 976dd0f6171d4588e89e874fcc765e92914b6d30
|
||||||
F src/os.c 60178f518c4d6c0dcb59f7292232281d7bea2dcf
|
F src/os.c 60178f518c4d6c0dcb59f7292232281d7bea2dcf
|
||||||
F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9
|
F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9
|
||||||
@@ -841,7 +841,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
|||||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||||
P 88bf9016277c133dfbf4f4b2be0c35c9fe9fabd6
|
P 9cebaf2dca6dc35e489537fe7c55474e1029a98e
|
||||||
R c5c5f9fc6458acbfcc375160225b3808
|
R da77b0ae4e15ab90a6a323c7de4ca438
|
||||||
U drh
|
U dan
|
||||||
Z 2830757563a35deecc4832f7a9731398
|
Z ef5f61caa72edd66e82b2e19ff2bf16a
|
||||||
|
@@ -1 +1 @@
|
|||||||
9cebaf2dca6dc35e489537fe7c55474e1029a98e
|
e82e32bd431ccacd276df8241592eb5519d87122
|
@@ -235,6 +235,7 @@ static void pthreadMutexEnter(sqlite3_mutex *p){
|
|||||||
*/
|
*/
|
||||||
pthread_mutex_lock(&p->mutex);
|
pthread_mutex_lock(&p->mutex);
|
||||||
#if SQLITE_MUTEX_NREF
|
#if SQLITE_MUTEX_NREF
|
||||||
|
assert( p->nRef>0 || p->owner==0 );
|
||||||
p->owner = pthread_self();
|
p->owner = pthread_self();
|
||||||
p->nRef++;
|
p->nRef++;
|
||||||
#endif
|
#endif
|
||||||
@@ -307,6 +308,7 @@ static void pthreadMutexLeave(sqlite3_mutex *p){
|
|||||||
assert( pthreadMutexHeld(p) );
|
assert( pthreadMutexHeld(p) );
|
||||||
#if SQLITE_MUTEX_NREF
|
#if SQLITE_MUTEX_NREF
|
||||||
p->nRef--;
|
p->nRef--;
|
||||||
|
if( p->nRef==0 ) p->owner = 0;
|
||||||
#endif
|
#endif
|
||||||
assert( p->nRef==0 || p->id==SQLITE_MUTEX_RECURSIVE );
|
assert( p->nRef==0 || p->id==SQLITE_MUTEX_RECURSIVE );
|
||||||
|
|
||||||
|
@@ -220,7 +220,7 @@ static sqlite3_mutex *winMutexAlloc(int iType){
|
|||||||
*/
|
*/
|
||||||
static void winMutexFree(sqlite3_mutex *p){
|
static void winMutexFree(sqlite3_mutex *p){
|
||||||
assert( p );
|
assert( p );
|
||||||
assert( p->nRef==0 );
|
assert( p->nRef==0 && p->owner==0 );
|
||||||
assert( p->id==SQLITE_MUTEX_FAST || p->id==SQLITE_MUTEX_RECURSIVE );
|
assert( p->id==SQLITE_MUTEX_FAST || p->id==SQLITE_MUTEX_RECURSIVE );
|
||||||
DeleteCriticalSection(&p->mutex);
|
DeleteCriticalSection(&p->mutex);
|
||||||
sqlite3_free(p);
|
sqlite3_free(p);
|
||||||
@@ -244,6 +244,7 @@ static void winMutexEnter(sqlite3_mutex *p){
|
|||||||
#endif
|
#endif
|
||||||
EnterCriticalSection(&p->mutex);
|
EnterCriticalSection(&p->mutex);
|
||||||
#ifdef SQLITE_DEBUG
|
#ifdef SQLITE_DEBUG
|
||||||
|
assert( p->nRef>0 || p->owner==0 );
|
||||||
p->owner = tid;
|
p->owner = tid;
|
||||||
p->nRef++;
|
p->nRef++;
|
||||||
if( p->trace ){
|
if( p->trace ){
|
||||||
@@ -297,6 +298,7 @@ static void winMutexLeave(sqlite3_mutex *p){
|
|||||||
assert( p->nRef>0 );
|
assert( p->nRef>0 );
|
||||||
assert( p->owner==tid );
|
assert( p->owner==tid );
|
||||||
p->nRef--;
|
p->nRef--;
|
||||||
|
if( p->nRef==0 ) p->owner = 0;
|
||||||
assert( p->nRef==0 || p->id==SQLITE_MUTEX_RECURSIVE );
|
assert( p->nRef==0 || p->id==SQLITE_MUTEX_RECURSIVE );
|
||||||
#endif
|
#endif
|
||||||
LeaveCriticalSection(&p->mutex);
|
LeaveCriticalSection(&p->mutex);
|
||||||
|
Reference in New Issue
Block a user