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:
21
src/notify.c
21
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;
|
||||
|
||||
Reference in New Issue
Block a user