aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2010-04-17 16:10:19 +0000
committerdrh <drh@noemail.net>2010-04-17 16:10:19 +0000
commit335c0faabda105793e8e527ca65a19c6e056389c (patch)
tree70657c8ca2b05eacd625919ff853aba6cd7114ea /src
parent4b93f6bd1e573b38989f6168f657c0742f373728 (diff)
downloadsqlite-335c0faabda105793e8e527ca65a19c6e056389c.tar.gz
sqlite-335c0faabda105793e8e527ca65a19c6e056389c.zip
It is possible for sqlite3.pUnlockConnection to be non-NULL when
sqlite3.pBlockingConnection is NULL, as the notify1.test script demonstrates. FossilOrigin-Name: 95ff76ef67d6189f54375973fa485d6eb464b029
Diffstat (limited to 'src')
-rw-r--r--src/notify.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/src/notify.c b/src/notify.c
index bfe8480d4..4c8ab0077 100644
--- a/src/notify.c
+++ b/src/notify.c
@@ -197,14 +197,9 @@ int sqlite3_unlock_notify(
*/
void sqlite3ConnectionBlocked(sqlite3 *db, sqlite3 *pBlocker){
enterMutex();
- if( db->pBlockingConnection==0 ){
- /*
- ** We can not register an unlock callback unless we think we are
- ** blocked.
- */
- assert( db->pUnlockConnection==0 );
- addToBlockedList(db);
- }
+ if( db->pBlockingConnection==0 && db->pUnlockConnection==0 ){
+ addToBlockedList(db);
+ }
db->pBlockingConnection = pBlocker;
leaveMutex();
}
@@ -307,15 +302,7 @@ void sqlite3ConnectionUnlocked(sqlite3 *db){
}
/* Step 3. */
- if( p->pBlockingConnection==0 ){
- /*
- ** If we were blocked on db, we would set
- ** pBlockingConnection to 0 above. And we can
- ** only wait on a connection we are blocked on.
- ** So if we were waiting on db (pUnlockConnection==db)
- ** then it would have been set to 0 above as well.
- */
- assert( p->pUnlockConnection==0 );
+ if( p->pBlockingConnection==0 && p->pUnlockConnection==0 ){
/* Remove connection p from the blocked connections list. */
*pp = p->pNextBlocked;
p->pNextBlocked = 0;