/ Check-in [9af2514c]
Login

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

Overview
Comment:Fix a bug in the HOMEGROWN_RECURSIVE_MUTEX implementation for unix. Ticket #3224. (CVS 5420)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9af2514c83782b4745bf48a4f82ff83111fa5535
User & Date: drh 2008-07-16 12:33:24
Context
2008-07-16
13:29
Update the "experimental" markings on C/C++ interfaces. (CVS 5421) check-in: 96e95aa5 user: drh tags: trunk
12:33
Fix a bug in the HOMEGROWN_RECURSIVE_MUTEX implementation for unix. Ticket #3224. (CVS 5420) check-in: 9af2514c user: drh tags: trunk
12:25
Activate testing of mem3 and mem5. Fix problems found. Tickets #3223 and #3225. Other test configuration changes. (CVS 5419) check-in: a3a78205 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/mutex_unix.c.

     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   ** This file contains the C functions that implement mutexes for pthreads
    13     13   **
    14         -** $Id: mutex_unix.c,v 1.12 2008/06/19 16:07:07 drh Exp $
           14  +** $Id: mutex_unix.c,v 1.13 2008/07/16 12:33:24 drh Exp $
    15     15   */
    16     16   #include "sqliteInt.h"
    17     17   
    18     18   /*
    19     19   ** The code in this file is only used if we are compiling threadsafe
    20     20   ** under unix with pthreads.
    21     21   **
................................................................................
   245    245     ** are not met, then the mutexes will fail and problems will result.
   246    246     */
   247    247     {
   248    248       pthread_t self = pthread_self();
   249    249       if( p->nRef>0 && pthread_equal(p->owner, self) ){
   250    250         p->nRef++;
   251    251         rc = SQLITE_OK;
   252         -    }else if( pthread_mutex_lock(&p->mutex)==0 ){
          252  +    }else if( pthread_mutex_trylock(&p->mutex)==0 ){
   253    253         assert( p->nRef==0 );
   254    254         p->owner = self;
   255    255         p->nRef = 1;
   256    256         rc = SQLITE_OK;
   257    257       }else{
   258    258         rc = SQLITE_BUSY;
   259    259       }