diff options
author | drh <drh@noemail.net> | 2010-06-03 18:02:48 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2010-06-03 18:02:48 +0000 |
commit | 05cb5b244b51197f997685a5aca7ec631303b502 (patch) | |
tree | c5b4534854d236326eaf9ad20fb559b8dd7264d3 /src | |
parent | db9d981a8da1454ddc6dbdab0951f0edc7a60123 (diff) | |
download | sqlite-05cb5b244b51197f997685a5aca7ec631303b502.tar.gz sqlite-05cb5b244b51197f997685a5aca7ec631303b502.zip |
Performance fix for winShmClose().
FossilOrigin-Name: ed7774de04978803e979580240148eba1de9166d
Diffstat (limited to 'src')
-rw-r--r-- | src/os_win.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/os_win.c b/src/os_win.c index faff42033..1a9994b08 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -1308,13 +1308,17 @@ static int winShmSystemLock( return rc; } +/* Forward references to VFS methods */ +static int winOpen(sqlite3_vfs*,const char*,sqlite3_file*,int,int*); +static int winDelete(sqlite3_vfs *,const char*,int); + /* ** Purge the winShmNodeList list of all entries with winShmNode.nRef==0. ** ** This is not a VFS shared-memory method; it is a utility function called ** by VFS shared-memory methods. */ -static void winShmPurge(void){ +static void winShmPurge(sqlite3_vfs *pVfs, int deleteFlag){ winShmNode **pp; winShmNode *p; assert( winShmMutexHeld() ); @@ -1332,6 +1336,7 @@ static void winShmPurge(void){ if( p->hFile.h != INVALID_HANDLE_VALUE ) { winClose((sqlite3_file *)&p->hFile); } + if( deleteFlag ) winDelete(pVfs, p->zFilename, 0); *pp = p->pNext; sqlite3_free(p); }else{ @@ -1340,10 +1345,6 @@ static void winShmPurge(void){ } } -/* Forward references to VFS methods */ -static int winOpen(sqlite3_vfs*,const char*,sqlite3_file*,int,int*); -static int winDelete(sqlite3_vfs *,const char*,int); - /* ** Open a shared-memory area. This particular implementation uses ** mmapped files. @@ -1457,7 +1458,7 @@ static int winShmOpen( /* Jump here on any error */ shm_open_err: winShmSystemLock(pShmNode, _SHM_UNLCK, WIN_SHM_DMS, 1); - winShmPurge(); /* This call frees pShmNode if required */ + winShmPurge(pDbFd->pVfs, 0); /* This call frees pShmNode if required */ sqlite3_free(p); sqlite3_free(pNew); winShmLeaveMutex(); @@ -1498,8 +1499,7 @@ static int winShmClose( assert( pShmNode->nRef>0 ); pShmNode->nRef--; if( pShmNode->nRef==0 ){ - if( deleteFlag ) winDelete(pDbFd->pVfs, pShmNode->zFilename, 0); - winShmPurge(); + winShmPurge(pDbFd->pVfs, deleteFlag); } winShmLeaveMutex(); |