SQLite

Check-in [2211486b69]
Login

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

Overview
Comment:Use sqlite3_mutex_notheld() instead of !sqlite3_mutex_held() inside of assert() statements since the former works when mutexing is disabled while the latter does not.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 2211486b69cf53f5efb1334aff8b403b26596102
User & Date: drh 2010-09-02 17:15:19.000
Context
2010-09-02
18:13
Fix an off-by-one error in the scratch memory allocator. (check-in: 5a9591607a user: drh tags: trunk)
17:15
Use sqlite3_mutex_notheld() instead of !sqlite3_mutex_held() inside of assert() statements since the former works when mutexing is disabled while the latter does not. (check-in: 2211486b69 user: drh tags: trunk)
14:35
Add test case to verify the previous change is correct. (check-in: 2a5eed35b4 user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/malloc.c.
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
      sqlite3_mutex_leave(mem0.mutex);
    }else{
      sqlite3_mutex_leave(mem0.mutex);
      p = sqlite3GlobalConfig.m.xMalloc(n);
    }
    sqlite3MemdebugSetType(p, MEMTYPE_SCRATCH);
  }
  assert( !sqlite3_mutex_held(mem0.mutex) );


#if SQLITE_THREADSAFE==0 && !defined(NDEBUG)
  /* Verify that no more than two scratch allocations per thread
  ** are outstanding at one time.  (This is only checked in the
  ** single-threaded case since checking in the multi-threaded case
  ** would be much more complicated.) */







|







361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
      sqlite3_mutex_leave(mem0.mutex);
    }else{
      sqlite3_mutex_leave(mem0.mutex);
      p = sqlite3GlobalConfig.m.xMalloc(n);
    }
    sqlite3MemdebugSetType(p, MEMTYPE_SCRATCH);
  }
  assert( sqlite3_mutex_notheld(mem0.mutex) );


#if SQLITE_THREADSAFE==0 && !defined(NDEBUG)
  /* Verify that no more than two scratch allocations per thread
  ** are outstanding at one time.  (This is only checked in the
  ** single-threaded case since checking in the multi-threaded case
  ** would be much more complicated.) */