1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-22 20:22:44 +03:00

It is possible for sqlite3.pUnlockConnection to be non-NULL when

sqlite3.pBlockingConnection is NULL, as the notify1.test script
demonstrates.

FossilOrigin-Name: 95ff76ef67d6189f54375973fa485d6eb464b029
This commit is contained in:
drh
2010-04-17 16:10:19 +00:00
parent 4b93f6bd1e
commit 335c0faabd
3 changed files with 22 additions and 25 deletions

View File

@@ -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;