diff options
author | drh <drh@noemail.net> | 2012-06-21 15:51:42 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2012-06-21 15:51:42 +0000 |
commit | ed68801b202841d67b33c8ce69999ecd659032e8 (patch) | |
tree | 409f6054a53aa2c1f3e8eb90d027dd77cdc77cd7 /src/backup.c | |
parent | 567520226aac5bef285e488cdd19f321ea415ccf (diff) | |
parent | 4104337270d3183eaa8c88038a8a83602b28e60d (diff) | |
download | sqlite-ed68801b202841d67b33c8ce69999ecd659032e8.tar.gz sqlite-ed68801b202841d67b33c8ce69999ecd659032e8.zip |
Add the sqlite3_close_v2() interface (from the deferred-close branch) that
allows close operations to happen out-of-order in bindings to
garbage-collected langauges.
FossilOrigin-Name: fb8893abeefabe9de44e34dcf4327764481189f5
Diffstat (limited to 'src/backup.c')
-rw-r--r-- | src/backup.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backup.c b/src/backup.c index 0ada33c3b..527ecb574 100644 --- a/src/backup.c +++ b/src/backup.c @@ -543,14 +543,14 @@ int sqlite3_backup_step(sqlite3_backup *p, int nPage){ */ int sqlite3_backup_finish(sqlite3_backup *p){ sqlite3_backup **pp; /* Ptr to head of pagers backup list */ - MUTEX_LOGIC( sqlite3_mutex *mutex; ) /* Mutex to protect source database */ + sqlite3 *pSrcDb; /* Source database connection */ int rc; /* Value to return */ /* Enter the mutexes */ if( p==0 ) return SQLITE_OK; - sqlite3_mutex_enter(p->pSrcDb->mutex); + pSrcDb = p->pSrcDb; + sqlite3_mutex_enter(pSrcDb->mutex); sqlite3BtreeEnter(p->pSrc); - MUTEX_LOGIC( mutex = p->pSrcDb->mutex; ) if( p->pDestDb ){ sqlite3_mutex_enter(p->pDestDb->mutex); } @@ -576,7 +576,7 @@ int sqlite3_backup_finish(sqlite3_backup *p){ /* Exit the mutexes and free the backup context structure. */ if( p->pDestDb ){ - sqlite3_mutex_leave(p->pDestDb->mutex); + sqlite3LeaveMutexAndCloseZombie(p->pDestDb); } sqlite3BtreeLeave(p->pSrc); if( p->pDestDb ){ @@ -585,7 +585,7 @@ int sqlite3_backup_finish(sqlite3_backup *p){ ** sqlite3_backup_finish(). */ sqlite3_free(p); } - sqlite3_mutex_leave(mutex); + sqlite3LeaveMutexAndCloseZombie(pSrcDb); return rc; } |