/ Check-in [f9a03483]
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:Clarify the new mutex implementation reset logic in sqlite3_shutdown().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | mutexInitCmpSwap
Files: files | file ages | folders
SHA1: f9a034834e6c6e32ac350cf48bec981490e533ad
User & Date: mistachkin 2015-09-12 03:40:13
Context
2015-09-12
04:19
Specifying an invalid mutex implementation (via SQLITE_CONFIG_MUTEX) should cause the default one to be used instead. check-in: 1a97bc81 user: mistachkin tags: mutexInitCmpSwap
03:40
Clarify the new mutex implementation reset logic in sqlite3_shutdown(). check-in: f9a03483 user: mistachkin tags: mutexInitCmpSwap
03:35
Add more asserts to the mutex subsystem. check-in: 7562f1fb user: mistachkin tags: mutexInitCmpSwap
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/main.c.

   330    330       sqlite3_temp_directory = 0;
   331    331   #endif
   332    332     }
   333    333     if( sqlite3GlobalConfig.isMutexInit ){
   334    334       sqlite3MutexEnd();
   335    335       sqlite3GlobalConfig.isMutexInit = 0;
   336    336     }
          337  +
          338  +  /*
          339  +  ** Force the state of the mutex subsystem to be completely reset now, even
          340  +  ** if the configured xMutexEnd(), if any, failed.  This is not thread-safe.
          341  +  ** This is necessary even if the xMutexInit() was never called, due to the
          342  +  ** possiblity of this state being changed via SQLITE_CONFIG_MUTEX.  After
          343  +  ** this point, the application must enable any custom mutex implementation
          344  +  ** again via SQLITE_CONFIG_MUTEX, if necessary.
          345  +  */
   337    346     sqlite3GlobalConfig.pMutex = 0;
          347  +  memset(&sqlite3GlobalConfig.mutex, 0, sizeof(sqlite3_mutex_methods));
   338    348   
   339    349     return SQLITE_OK;
   340    350   }
   341    351   
   342    352   /*
   343    353   ** This API allows applications to modify the global configuration of
   344    354   ** the SQLite library at run-time.