1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Add missing mutexes to unixShmClose().

FossilOrigin-Name: a4741cb54dd5e753d48fd05ac9dbe27ee4aa1ec0
This commit is contained in:
dan
2010-04-30 10:06:09 +00:00
parent 4c97b53425
commit e93808dde2
3 changed files with 13 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
C Fix\sa\scouple\sof\sassert()\sstatements\sin\sos_unix.c\sand\swal.c.\sCombine\ssqlite3WalIsDirty()\swith\ssqlite3WalUndo(). C Add\smissing\smutexes\sto\sunixShmClose().
D 2010-04-30T09:52:18 D 2010-04-30T10:06:10
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in d83a0ffef3dcbfb08b410a6c6dd6c009ec9167fb F Makefile.in d83a0ffef3dcbfb08b410a6c6dd6c009ec9167fb
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -150,7 +150,7 @@ F src/os.c 8bc63cf91e9802e2b807198e54e50227fa889306
F src/os.h 534b082c3cb349ad05fa6fa0b06087e022af282c F src/os.h 534b082c3cb349ad05fa6fa0b06087e022af282c
F src/os_common.h 0d6ee583b6ee3185eb9d951f890c6dd03021a08d F src/os_common.h 0d6ee583b6ee3185eb9d951f890c6dd03021a08d
F src/os_os2.c 8ad77a418630d7dee91d1bb04f79c2096301d3a0 F src/os_os2.c 8ad77a418630d7dee91d1bb04f79c2096301d3a0
F src/os_unix.c 685b0347383b5d12dee9961b3cc0337ff075617b F src/os_unix.c f5e41bd2f563f85c10a9c9e62bbac8e3b783efc3
F src/os_win.c a8fc01d8483be472e495793c01064fd87e56a5c1 F src/os_win.c a8fc01d8483be472e495793c01064fd87e56a5c1
F src/pager.c 434f9751fc2dfc11ade004282deda5f8560bcba2 F src/pager.c 434f9751fc2dfc11ade004282deda5f8560bcba2
F src/pager.h 934b598583a9d936bb13c37d62a2fe68ac48781c F src/pager.h 934b598583a9d936bb13c37d62a2fe68ac48781c
@@ -808,7 +808,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 72b95fde15dae56390dc8d4168fb2757447e289e P a8f958be804ee05c4137b3cd110db344713af5f2
R 8864259ed44807eea46d7c4986422a72 R 5f2e996a1ab6f83c7e08f128286e26ff
U dan U dan
Z 967d048f88e642230f471eb242428feb Z 8a044884de878c7767a8936662f5ee57

View File

@@ -1 +1 @@
a8f958be804ee05c4137b3cd110db344713af5f2 a4741cb54dd5e753d48fd05ac9dbe27ee4aa1ec0

View File

@@ -5046,7 +5046,6 @@ static int unixShmClose(sqlite3_shm *pSharedMem){
unixShm *p; /* The connection to be closed */ unixShm *p; /* The connection to be closed */
unixShmFile *pFile; /* The underlying shared-memory file */ unixShmFile *pFile; /* The underlying shared-memory file */
unixShm **pp; /* For looping over sibling connections */ unixShm **pp; /* For looping over sibling connections */
int nRef; /* Number of connections to pFile */
if( pSharedMem==0 ) return SQLITE_OK; if( pSharedMem==0 ) return SQLITE_OK;
p = (struct unixShm*)pSharedMem; p = (struct unixShm*)pSharedMem;
@@ -5056,13 +5055,10 @@ static int unixShmClose(sqlite3_shm *pSharedMem){
assert( p->exclMask==0 ); assert( p->exclMask==0 );
assert( p->sharedMask==0 ); assert( p->sharedMask==0 );
/* Remove connection p from the set of connections associated with pFile */ /* Remove connection p from the set of connections associated with pFile */
sqlite3_mutex_enter(pFile->mutex); sqlite3_mutex_enter(pFile->mutex);
for(pp=&pFile->pFirst; (*pp)!=p; pp = &(*pp)->pNext){} for(pp=&pFile->pFirst; (*pp)!=p; pp = &(*pp)->pNext){}
*pp = p->pNext; *pp = p->pNext;
pFile->nRef--;
nRef = pFile->nRef;
/* Free the connection p */ /* Free the connection p */
sqlite3_free(p); sqlite3_free(p);
@@ -5070,9 +5066,14 @@ static int unixShmClose(sqlite3_shm *pSharedMem){
/* If pFile->nRef has reached 0, then close the underlying /* If pFile->nRef has reached 0, then close the underlying
** shared-memory file, too */ ** shared-memory file, too */
if( nRef==0 ){ unixEnterMutex();
assert( pFile->nRef>0 );
pFile->nRef--;
if( pFile->nRef==0 ){
unixShmPurge(); unixShmPurge();
} }
unixLeaveMutex();
return SQLITE_OK; return SQLITE_OK;
} }