diff options
author | drh <drh@noemail.net> | 2012-06-02 14:32:21 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2012-06-02 14:32:21 +0000 |
commit | 4245c405ea9ef9115dd2dd6b81afc10a6edf67d1 (patch) | |
tree | b28f55712f79145318fc5aaed0e1a7927865b44f /src/vdbeapi.c | |
parent | ed4668271909964bfa81cc968ccbea5be7f4c15e (diff) | |
download | sqlite-4245c405ea9ef9115dd2dd6b81afc10a6edf67d1.tar.gz sqlite-4245c405ea9ef9115dd2dd6b81afc10a6edf67d1.zip |
The sqlite3_close() interface returns SQLITE_OK even if there are outstanding
sqlite3_stmt and sqlite3_backup objects. The connection becomes a zombie.
Resource deallocation is deferred until the last sqlite3_stmt or
sqlite3_backup object closes. This is intended to help SQLite play nicer
with garbage collectors.
FossilOrigin-Name: e276a02b7f54e804caa553dca99023416a415e1c
Diffstat (limited to 'src/vdbeapi.c')
-rw-r--r-- | src/vdbeapi.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/vdbeapi.c b/src/vdbeapi.c index 94db205e1..e25acd944 100644 --- a/src/vdbeapi.c +++ b/src/vdbeapi.c @@ -71,17 +71,12 @@ int sqlite3_finalize(sqlite3_stmt *pStmt){ }else{ Vdbe *v = (Vdbe*)pStmt; sqlite3 *db = v->db; -#if SQLITE_THREADSAFE - sqlite3_mutex *mutex; -#endif if( vdbeSafety(v) ) return SQLITE_MISUSE_BKPT; -#if SQLITE_THREADSAFE - mutex = v->db->mutex; -#endif - sqlite3_mutex_enter(mutex); + sqlite3_mutex_enter(db->mutex); rc = sqlite3VdbeFinalize(v); + if( (rc&0xff)==SQLITE_MISUSE ) rc = SQLITE_OK; rc = sqlite3ApiExit(db, rc); - sqlite3_mutex_leave(mutex); + sqlite3LeaveMutexAndCloseZombie(db); } return rc; } |