/ Check-in [95ff76ef]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:It is possible for sqlite3.pUnlockConnection to be non-NULL when sqlite3.pBlockingConnection is NULL, as the notify1.test script demonstrates.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | experimental
Files: files | file ages | folders
SHA1: 95ff76ef67d6189f54375973fa485d6eb464b029
User & Date: drh 2010-04-17 16:10:19
Original Comment: It is possible for sqlite3.pUnlockConnection to be non-NULL when sqlite3.pBlockingConnection is NULL, as the notify1.test script demonstrates.
Context
2010-04-23
14:29
Merge of notify.c changes from experimental. Reset stored blocking connection when registered unlock_notify callback is cleared. check-in: e79dac3c user: shaneh tags: trunk
2010-04-17
16:10
It is possible for sqlite3.pUnlockConnection to be non-NULL when sqlite3.pBlockingConnection is NULL, as the notify1.test script demonstrates. Closed-Leaf check-in: 95ff76ef user: drh tags: experimental
2010-04-16
22:05
Changes for branch coverage of notify.c. Fixed quirk of unlock_notify() where it would still think it was blocked after a callback was cleared (even after the transaction on the blocking connection was closed). check-in: c54e8dad user: shaneh tags: experimental
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/notify.c.

193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
...
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
** This function is called while stepping or preparing a statement 
** associated with connection db. The operation will return SQLITE_LOCKED
** to the user because it requires a lock that will not be available
** until connection pBlocker concludes its current transaction.
*/
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);
  }
  db->pBlockingConnection = pBlocker;
  leaveMutex();
}

/*
................................................................................
      xUnlockNotify = p->xUnlockNotify;
      p->pUnlockConnection = 0;
      p->xUnlockNotify = 0;
      p->pUnlockArg = 0;
    }

    /* 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 );
      /* Remove connection p from the blocked connections list. */
      *pp = p->pNextBlocked;
      p->pNextBlocked = 0;
    }else{
      pp = &p->pNextBlocked;
    }
  }







|
<
<
<
<
<







 







|
<
<
<
<
<
<
<
<







193
194
195
196
197
198
199
200





201
202
203
204
205
206
207
...
298
299
300
301
302
303
304
305








306
307
308
309
310
311
312
** This function is called while stepping or preparing a statement 
** associated with connection db. The operation will return SQLITE_LOCKED
** to the user because it requires a lock that will not be available
** until connection pBlocker concludes its current transaction.
*/
void sqlite3ConnectionBlocked(sqlite3 *db, sqlite3 *pBlocker){
  enterMutex();
  if( db->pBlockingConnection==0 && db->pUnlockConnection==0 ){





    addToBlockedList(db);
  }
  db->pBlockingConnection = pBlocker;
  leaveMutex();
}

/*
................................................................................
      xUnlockNotify = p->xUnlockNotify;
      p->pUnlockConnection = 0;
      p->xUnlockNotify = 0;
      p->pUnlockArg = 0;
    }

    /* Step 3. */
    if( p->pBlockingConnection==0 && p->pUnlockConnection==0 ){








      /* Remove connection p from the blocked connections list. */
      *pp = p->pNextBlocked;
      p->pNextBlocked = 0;
    }else{
      pp = &p->pNextBlocked;
    }
  }