/ Check-in [f1cf02ef]
Login

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

Overview
Comment:Do not use SQLITE_MUTEX_STATIC_MEM2 since it has been reused as STATIC_OPEN. Instead, create a new static mutex STATIC_PMEM which is an alias for the unused STATIC_LRU2.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | mutex-free-pcache
Files: files | file ages | folders
SHA1: f1cf02efcb3a871fef49f8b5f41bcf07622a6d29
User & Date: drh 2011-01-18 15:17:57
Context
2011-01-18
16:13
Get all test cases working with the mutex-free-pcache implementation. Closed-Leaf check-in: 2dc98d29 user: drh tags: mutex-free-pcache
15:17
Do not use SQLITE_MUTEX_STATIC_MEM2 since it has been reused as STATIC_OPEN. Instead, create a new static mutex STATIC_PMEM which is an alias for the unused STATIC_LRU2. check-in: f1cf02ef user: drh tags: mutex-free-pcache
2011-01-17
21:32
Here is a completely new implementation of the mutex-free-pcache. This one uses a common code base and automatically selects whether or not to use mutexes depending on compile-time and start-time options. check-in: d094a1bf user: drh tags: mutex-free-pcache
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/pcache1.c.

   510    510   */
   511    511   static int pcache1Init(void *NotUsed){
   512    512     UNUSED_PARAMETER(NotUsed);
   513    513     assert( pcache1.isInit==0 );
   514    514     memset(&pcache1, 0, sizeof(pcache1));
   515    515     if( sqlite3GlobalConfig.bCoreMutex ){
   516    516       pcache1.grp.mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_LRU);
   517         -    pcache1.mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MEM2);
          517  +    pcache1.mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_PMEM);
   518    518     }
   519    519     pcache1.isInit = 1;
   520    520     return SQLITE_OK;
   521    521   }
   522    522   
   523    523   /*
   524    524   ** Implementation of the sqlite3_pcache.xShutdown method.

Changes to src/sqlite.h.in.

  5262   5262   #define SQLITE_MUTEX_RECURSIVE        1
  5263   5263   #define SQLITE_MUTEX_STATIC_MASTER    2
  5264   5264   #define SQLITE_MUTEX_STATIC_MEM       3  /* sqlite3_malloc() */
  5265   5265   #define SQLITE_MUTEX_STATIC_MEM2      4  /* NOT USED */
  5266   5266   #define SQLITE_MUTEX_STATIC_OPEN      4  /* sqlite3BtreeOpen() */
  5267   5267   #define SQLITE_MUTEX_STATIC_PRNG      5  /* sqlite3_random() */
  5268   5268   #define SQLITE_MUTEX_STATIC_LRU       6  /* lru page list */
  5269         -#define SQLITE_MUTEX_STATIC_LRU2      7  /* lru page list */
         5269  +#define SQLITE_MUTEX_STATIC_LRU2      7  /* NOT USED */
         5270  +#define SQLITE_MUTEX_STATIC_PMEM      7  /* sqlite3PageMalloc() */
  5270   5271   
  5271   5272   /*
  5272   5273   ** CAPI3REF: Retrieve the mutex for a database connection
  5273   5274   **
  5274   5275   ** ^This interface returns a pointer the [sqlite3_mutex] object that 
  5275   5276   ** serializes access to the [database connection] given in the argument
  5276   5277   ** when the [threading mode] is Serialized.