/ Check-in [609022ca]
Login

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

Overview
Comment:Use an ALWAYS() on a conditional in btmutex.c that is always true. (CVS 6910)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 609022caff12c010575e704be550da6f52226d33
User & Date: drh 2009-07-20 12:33:33
Context
2009-07-20
17:11
Modify various routines inside btree.c to take a pointer to the return-code as a parameter and to no-op if the return-code storage location already contains a non-zero code. (CVS 6911) check-in: 7dcf2a78 user: drh tags: trunk
12:33
Use an ALWAYS() on a conditional in btmutex.c that is always true. (CVS 6910) check-in: 609022ca user: drh tags: trunk
12:25
Corrections to the comment that is inserted at the top of the amalgamation. Ticket #3981. (CVS 6909) check-in: 7572991b user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/btmutex.c.

     6      6   **
     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   **
    13         -** $Id: btmutex.c,v 1.16 2009/07/17 11:44:07 drh Exp $
           13  +** $Id: btmutex.c,v 1.17 2009/07/20 12:33:33 drh Exp $
    14     14   **
    15     15   ** This file contains code used to implement mutexes on Btree objects.
    16     16   ** This code really belongs in btree.c.  But btree.c is getting too
    17     17   ** big and we want to break it down some.  This packaged seemed like
    18     18   ** a good breakout.
    19     19   */
    20     20   #include "btreeInt.h"
................................................................................
   193    193       p = db->aDb[i].pBt;
   194    194       assert( !p || (p->locked==0 && p->sharable) || p->pBt->db==p->db );
   195    195       if( p && p->sharable ){
   196    196         p->wantToLock++;
   197    197         if( !p->locked ){
   198    198           assert( p->wantToLock==1 );
   199    199           while( p->pPrev ) p = p->pPrev;
   200         -        while( p->locked && p->pNext ) p = p->pNext;
          200  +        /* Reason for ALWAYS:  There must be at least on unlocked Btree in
          201  +        ** the chain.  Otherwise the !p->locked test above would have failed */
          202  +        while( p->locked && ALWAYS(p->pNext) ) p = p->pNext;
   201    203           for(pLater = p->pNext; pLater; pLater=pLater->pNext){
   202    204             if( pLater->locked ){
   203    205               unlockBtreeMutex(pLater);
   204    206             }
   205    207           }
   206    208           while( p ){
   207    209             lockBtreeMutex(p);