OLD | NEW |
1 /* | 1 /* |
2 ** 2007 August 14 | 2 ** 2007 August 14 |
3 ** | 3 ** |
4 ** The author disclaims copyright to this source code. In place of | 4 ** The author disclaims copyright to this source code. In place of |
5 ** a legal notice, here is a blessing: | 5 ** a legal notice, here is a blessing: |
6 ** | 6 ** |
7 ** May you do good and not evil. | 7 ** May you do good and not evil. |
8 ** May you find forgiveness for yourself and forgive others. | 8 ** May you find forgiveness for yourself and forgive others. |
9 ** May you share freely, never taking more than you give. | 9 ** May you share freely, never taking more than you give. |
10 ** | 10 ** |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 #endif | 74 #endif |
75 | 75 |
76 return rc; | 76 return rc; |
77 } | 77 } |
78 | 78 |
79 /* | 79 /* |
80 ** Retrieve a pointer to a static mutex or allocate a new dynamic one. | 80 ** Retrieve a pointer to a static mutex or allocate a new dynamic one. |
81 */ | 81 */ |
82 sqlite3_mutex *sqlite3_mutex_alloc(int id){ | 82 sqlite3_mutex *sqlite3_mutex_alloc(int id){ |
83 #ifndef SQLITE_OMIT_AUTOINIT | 83 #ifndef SQLITE_OMIT_AUTOINIT |
84 if( sqlite3_initialize() ) return 0; | 84 if( id<=SQLITE_MUTEX_RECURSIVE && sqlite3_initialize() ) return 0; |
85 #endif | 85 #endif |
86 return sqlite3GlobalConfig.mutex.xMutexAlloc(id); | 86 return sqlite3GlobalConfig.mutex.xMutexAlloc(id); |
87 } | 87 } |
88 | 88 |
89 sqlite3_mutex *sqlite3MutexAlloc(int id){ | 89 sqlite3_mutex *sqlite3MutexAlloc(int id){ |
90 if( !sqlite3GlobalConfig.bCoreMutex ){ | 90 if( !sqlite3GlobalConfig.bCoreMutex ){ |
91 return 0; | 91 return 0; |
92 } | 92 } |
93 assert( GLOBAL(int, mutexIsInit) ); | 93 assert( GLOBAL(int, mutexIsInit) ); |
94 return sqlite3GlobalConfig.mutex.xMutexAlloc(id); | 94 return sqlite3GlobalConfig.mutex.xMutexAlloc(id); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 ** intended for use inside assert() statements. | 143 ** intended for use inside assert() statements. |
144 */ | 144 */ |
145 int sqlite3_mutex_held(sqlite3_mutex *p){ | 145 int sqlite3_mutex_held(sqlite3_mutex *p){ |
146 return p==0 || sqlite3GlobalConfig.mutex.xMutexHeld(p); | 146 return p==0 || sqlite3GlobalConfig.mutex.xMutexHeld(p); |
147 } | 147 } |
148 int sqlite3_mutex_notheld(sqlite3_mutex *p){ | 148 int sqlite3_mutex_notheld(sqlite3_mutex *p){ |
149 return p==0 || sqlite3GlobalConfig.mutex.xMutexNotheld(p); | 149 return p==0 || sqlite3GlobalConfig.mutex.xMutexNotheld(p); |
150 } | 150 } |
151 #endif | 151 #endif |
152 | 152 |
153 #endif /* SQLITE_MUTEX_OMIT */ | 153 #endif /* !defined(SQLITE_MUTEX_OMIT) */ |
OLD | NEW |