/ Check-in [489c453d]
Login

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

Overview
Comment:Provide the ability to specify an alternative mutex subsystem at compile-time. - This check-in should have gone on the trunk, not on the 3.7.6 branch.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | mistake
Files: files | file ages | folders
SHA1: 489c453d4ebb0358c4d7b8dedce5187bcbc7324f
User & Date: drh 2011-05-10 14:52:06
Original Comment: Provide the ability to specify an alternative mutex subsystem at compile-time.
Context
2011-05-10
14:52
Provide the ability to specify an alternative mutex subsystem at compile-time. - This check-in should have gone on the trunk, not on the 3.7.6 branch. Closed-Leaf check-in: 489c453d user: drh tags: mistake
2011-04-17
17:25
Version 3.7.6.2 check-in: 154ddbc1 user: drh tags: release, version-3.7.6.2, branch-3.7.6
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/mutex.c.

    20     20   ** For debugging purposes, record when the mutex subsystem is initialized
    21     21   ** and uninitialized so that we can assert() if there is an attempt to
    22     22   ** allocate a mutex while the system is uninitialized.
    23     23   */
    24     24   static SQLITE_WSD int mutexIsInit = 0;
    25     25   #endif /* SQLITE_DEBUG */
    26     26   
           27  +/*
           28  +** Implementations can specify an alternative routine for initializing
           29  +** the mutex using the SQLITE_MUTEX_DEFAULT macro.  This macro should
           30  +** resolve to an expression that returns a pointer to an
           31  +** sqlite3_mutex_methods object that implements the default mutex.
           32  +** This is an undocumented feature and may not be supported in future 
           33  +** releases.
           34  +*/
           35  +#if !defined(SQLITE_MUTEX_DEFAULT)
           36  +# define SQLITE_MUTEX_DEFAULT sqlite3DefaultMutex()
           37  +#endif
           38  +
    27     39   
    28     40   #ifndef SQLITE_MUTEX_OMIT
    29     41   /*
    30     42   ** Initialize the mutex system.
    31     43   */
    32     44   int sqlite3MutexInit(void){ 
    33     45     int rc = SQLITE_OK;
................................................................................
    37     49       ** sqlite3_initialize() being called. This block copies pointers to
    38     50       ** the default implementation into the sqlite3GlobalConfig structure.
    39     51       */
    40     52       sqlite3_mutex_methods const *pFrom;
    41     53       sqlite3_mutex_methods *pTo = &sqlite3GlobalConfig.mutex;
    42     54   
    43     55       if( sqlite3GlobalConfig.bCoreMutex ){
    44         -      pFrom = sqlite3DefaultMutex();
           56  +      pFrom = SQLITE_MUTEX_DEFAULT;
    45     57       }else{
    46     58         pFrom = sqlite3NoopMutex();
    47     59       }
    48     60       memcpy(pTo, pFrom, offsetof(sqlite3_mutex_methods, xMutexAlloc));
    49     61       memcpy(&pTo->xMutexFree, &pFrom->xMutexFree,
    50     62              sizeof(*pTo) - offsetof(sqlite3_mutex_methods, xMutexFree));
    51     63       pTo->xMutexAlloc = pFrom->xMutexAlloc;