/ 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 Unified Diffs Show Whitespace Changes Patch

Changes to src/mutex.c.

20
21
22
23
24
25
26












27
28
29
30
31
32
33
..
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
** For debugging purposes, record when the mutex subsystem is initialized
** and uninitialized so that we can assert() if there is an attempt to
** allocate a mutex while the system is uninitialized.
*/
static SQLITE_WSD int mutexIsInit = 0;
#endif /* SQLITE_DEBUG */














#ifndef SQLITE_MUTEX_OMIT
/*
** Initialize the mutex system.
*/
int sqlite3MutexInit(void){ 
  int rc = SQLITE_OK;
................................................................................
    ** sqlite3_initialize() being called. This block copies pointers to
    ** the default implementation into the sqlite3GlobalConfig structure.
    */
    sqlite3_mutex_methods const *pFrom;
    sqlite3_mutex_methods *pTo = &sqlite3GlobalConfig.mutex;

    if( sqlite3GlobalConfig.bCoreMutex ){
      pFrom = sqlite3DefaultMutex();
    }else{
      pFrom = sqlite3NoopMutex();
    }
    memcpy(pTo, pFrom, offsetof(sqlite3_mutex_methods, xMutexAlloc));
    memcpy(&pTo->xMutexFree, &pFrom->xMutexFree,
           sizeof(*pTo) - offsetof(sqlite3_mutex_methods, xMutexFree));
    pTo->xMutexAlloc = pFrom->xMutexAlloc;







>
>
>
>
>
>
>
>
>
>
>
>







 







|







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
..
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
** For debugging purposes, record when the mutex subsystem is initialized
** and uninitialized so that we can assert() if there is an attempt to
** allocate a mutex while the system is uninitialized.
*/
static SQLITE_WSD int mutexIsInit = 0;
#endif /* SQLITE_DEBUG */

/*
** Implementations can specify an alternative routine for initializing
** the mutex using the SQLITE_MUTEX_DEFAULT macro.  This macro should
** resolve to an expression that returns a pointer to an
** sqlite3_mutex_methods object that implements the default mutex.
** This is an undocumented feature and may not be supported in future 
** releases.
*/
#if !defined(SQLITE_MUTEX_DEFAULT)
# define SQLITE_MUTEX_DEFAULT sqlite3DefaultMutex()
#endif


#ifndef SQLITE_MUTEX_OMIT
/*
** Initialize the mutex system.
*/
int sqlite3MutexInit(void){ 
  int rc = SQLITE_OK;
................................................................................
    ** sqlite3_initialize() being called. This block copies pointers to
    ** the default implementation into the sqlite3GlobalConfig structure.
    */
    sqlite3_mutex_methods const *pFrom;
    sqlite3_mutex_methods *pTo = &sqlite3GlobalConfig.mutex;

    if( sqlite3GlobalConfig.bCoreMutex ){
      pFrom = SQLITE_MUTEX_DEFAULT;
    }else{
      pFrom = sqlite3NoopMutex();
    }
    memcpy(pTo, pFrom, offsetof(sqlite3_mutex_methods, xMutexAlloc));
    memcpy(&pTo->xMutexFree, &pFrom->xMutexFree,
           sizeof(*pTo) - offsetof(sqlite3_mutex_methods, xMutexFree));
    pTo->xMutexAlloc = pFrom->xMutexAlloc;