/ Check-in [3d8b298d]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Add a mutex around an sqlite3StatusAdd() call to prevent the pagecount overflow measurements from getting off in multithreaded applications.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3d8b298dc24fe13a3f390da41f79b8613a6f25a7
User & Date: drh 2011-01-26 13:24:40
Context
2011-01-26
13:28
More mutexes around another sqlite3StatusAdd() call. check-in: e3b500fb user: drh tags: trunk
13:24
Add a mutex around an sqlite3StatusAdd() call to prevent the pagecount overflow measurements from getting off in multithreaded applications. check-in: 3d8b298d user: drh tags: trunk
07:25
Update mutex1.test so that it works with the memsubsys1 permutation (pagecache memory). Change a few instances of SQLITE_MUTEX_STATIC_LRU2 in comments and test code to STATIC_PMEM. check-in: 456bd5c6 user: dan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/pcache1.c.

224
225
226
227
228
229
230

231

232
233
234
235
236
237
238
  if( p==0 ){
    /* Memory is not available in the SQLITE_CONFIG_PAGECACHE pool.  Get
    ** it from sqlite3Malloc instead.
    */
    p = sqlite3Malloc(nByte);
    if( p ){
      int sz = sqlite3MallocSize(p);

      sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_OVERFLOW, sz);

    }
    sqlite3MemdebugSetType(p, MEMTYPE_PCACHE);
  }
  return p;
}

/*







>

>







224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
  if( p==0 ){
    /* Memory is not available in the SQLITE_CONFIG_PAGECACHE pool.  Get
    ** it from sqlite3Malloc instead.
    */
    p = sqlite3Malloc(nByte);
    if( p ){
      int sz = sqlite3MallocSize(p);
      sqlite3_mutex_enter(pcache1.mutex);
      sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_OVERFLOW, sz);
      sqlite3_mutex_leave(pcache1.mutex);
    }
    sqlite3MemdebugSetType(p, MEMTYPE_PCACHE);
  }
  return p;
}

/*