/ Check-in [de3fa51e]
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:Fix comments.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | mutexInitCmpSwap
Files: files | file ages | folders
SHA1: de3fa51e931d34f341fc3432bfdf97390bb68d4e
User & Date: mistachkin 2015-09-12 04:22:01
Context
2015-09-12
16:59
Merge updates from trunk. check-in: 48597789 user: mistachkin tags: mutexInitCmpSwap
04:22
Fix comments. check-in: de3fa51e user: mistachkin tags: mutexInitCmpSwap
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
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/mutex.c.

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
..
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
*/
static SQLITE_WSD int mutexIsInit = 0;
#endif /* SQLITE_DEBUG && !defined(SQLITE_MUTEX_OMIT) */


#ifndef SQLITE_MUTEX_OMIT
/*
** This structure is for use by sqlite3MutexInit() only.  It represents an
** invalid mutex implementation (i.e. one where all the function pointers
** are null).
*/
static const sqlite3_mutex_methods mutexNullMethods = {
  0, /* xMutexInit */
  0, /* xMutexEnd */
  0, /* xMutexAlloc */
................................................................................
/*
** Initialize the mutex system.
*/
int sqlite3MutexInit(void){ 
  int rc;
  if( sqlite3CompareAndSwap((void * volatile *)&sqlite3GlobalConfig.pMutex,
                   0, &sqlite3GlobalConfig.mutex)==0 || mutexIsInvalid() ){
    /* If the xMutexAlloc method has not been set, then the user did not
    ** install a mutex implementation via sqlite3_config() prior to 
    ** sqlite3_initialize() being called. This block copies pointers to
    ** the default implementation into the sqlite3GlobalConfig structure.
    */
    sqlite3_mutex_methods const *pFrom;

    if( sqlite3GlobalConfig.bCoreMutex ){
      pFrom = sqlite3DefaultMutex();
    }else{
      pFrom = sqlite3NoopMutex();







|







 







|
|
|
|







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
..
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
*/
static SQLITE_WSD int mutexIsInit = 0;
#endif /* SQLITE_DEBUG && !defined(SQLITE_MUTEX_OMIT) */


#ifndef SQLITE_MUTEX_OMIT
/*
** This structure is for use by mutexIsInvalid() only.  It represents an
** invalid mutex implementation (i.e. one where all the function pointers
** are null).
*/
static const sqlite3_mutex_methods mutexNullMethods = {
  0, /* xMutexInit */
  0, /* xMutexEnd */
  0, /* xMutexAlloc */
................................................................................
/*
** Initialize the mutex system.
*/
int sqlite3MutexInit(void){ 
  int rc;
  if( sqlite3CompareAndSwap((void * volatile *)&sqlite3GlobalConfig.pMutex,
                   0, &sqlite3GlobalConfig.mutex)==0 || mutexIsInvalid() ){
    /* If the mutex implementation pointer has not been set, then the user
    ** did not install a mutex implementation via sqlite3_config() prior to
    ** sqlite3_initialize() being called.  This block copies the pointers
    ** for the default implementation into the sqlite3GlobalConfig structure.
    */
    sqlite3_mutex_methods const *pFrom;

    if( sqlite3GlobalConfig.bCoreMutex ){
      pFrom = sqlite3DefaultMutex();
    }else{
      pFrom = sqlite3NoopMutex();