Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: third_party/sqlite/sqlite-src-3080704/src/mutex_unix.c

Issue 883353008: [sql] Import reference version of SQLite 3.8.7.4. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Hold back encoding change which is messing up patch. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 ** 2007 August 28 2 ** 2007 August 28
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 ** mutex and returns a pointer to it. If it returns NULL 89 ** mutex and returns a pointer to it. If it returns NULL
90 ** that means that a mutex could not be allocated. SQLite 90 ** that means that a mutex could not be allocated. SQLite
91 ** will unwind its stack and return an error. The argument 91 ** will unwind its stack and return an error. The argument
92 ** to sqlite3_mutex_alloc() is one of these integer constants: 92 ** to sqlite3_mutex_alloc() is one of these integer constants:
93 ** 93 **
94 ** <ul> 94 ** <ul>
95 ** <li> SQLITE_MUTEX_FAST 95 ** <li> SQLITE_MUTEX_FAST
96 ** <li> SQLITE_MUTEX_RECURSIVE 96 ** <li> SQLITE_MUTEX_RECURSIVE
97 ** <li> SQLITE_MUTEX_STATIC_MASTER 97 ** <li> SQLITE_MUTEX_STATIC_MASTER
98 ** <li> SQLITE_MUTEX_STATIC_MEM 98 ** <li> SQLITE_MUTEX_STATIC_MEM
99 ** <li> SQLITE_MUTEX_STATIC_MEM2 99 ** <li> SQLITE_MUTEX_STATIC_OPEN
100 ** <li> SQLITE_MUTEX_STATIC_PRNG 100 ** <li> SQLITE_MUTEX_STATIC_PRNG
101 ** <li> SQLITE_MUTEX_STATIC_LRU 101 ** <li> SQLITE_MUTEX_STATIC_LRU
102 ** <li> SQLITE_MUTEX_STATIC_PMEM 102 ** <li> SQLITE_MUTEX_STATIC_PMEM
103 ** <li> SQLITE_MUTEX_STATIC_APP1
104 ** <li> SQLITE_MUTEX_STATIC_APP2
105 ** <li> SQLITE_MUTEX_STATIC_APP3
103 ** </ul> 106 ** </ul>
104 ** 107 **
105 ** The first two constants cause sqlite3_mutex_alloc() to create 108 ** The first two constants cause sqlite3_mutex_alloc() to create
106 ** a new mutex. The new mutex is recursive when SQLITE_MUTEX_RECURSIVE 109 ** a new mutex. The new mutex is recursive when SQLITE_MUTEX_RECURSIVE
107 ** is used but not necessarily so when SQLITE_MUTEX_FAST is used. 110 ** is used but not necessarily so when SQLITE_MUTEX_FAST is used.
108 ** The mutex implementation does not need to make a distinction 111 ** The mutex implementation does not need to make a distinction
109 ** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does 112 ** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does
110 ** not want to. But SQLite will only request a recursive mutex in 113 ** not want to. But SQLite will only request a recursive mutex in
111 ** cases where it really needs one. If a faster non-recursive mutex 114 ** cases where it really needs one. If a faster non-recursive mutex
112 ** implementation is available on the host platform, the mutex subsystem 115 ** implementation is available on the host platform, the mutex subsystem
(...skipping 13 matching lines...) Expand all
126 ** mutex types, the same mutex is returned on every call that has 129 ** mutex types, the same mutex is returned on every call that has
127 ** the same type number. 130 ** the same type number.
128 */ 131 */
129 static sqlite3_mutex *pthreadMutexAlloc(int iType){ 132 static sqlite3_mutex *pthreadMutexAlloc(int iType){
130 static sqlite3_mutex staticMutexes[] = { 133 static sqlite3_mutex staticMutexes[] = {
131 SQLITE3_MUTEX_INITIALIZER, 134 SQLITE3_MUTEX_INITIALIZER,
132 SQLITE3_MUTEX_INITIALIZER, 135 SQLITE3_MUTEX_INITIALIZER,
133 SQLITE3_MUTEX_INITIALIZER, 136 SQLITE3_MUTEX_INITIALIZER,
134 SQLITE3_MUTEX_INITIALIZER, 137 SQLITE3_MUTEX_INITIALIZER,
135 SQLITE3_MUTEX_INITIALIZER, 138 SQLITE3_MUTEX_INITIALIZER,
139 SQLITE3_MUTEX_INITIALIZER,
140 SQLITE3_MUTEX_INITIALIZER,
141 SQLITE3_MUTEX_INITIALIZER,
136 SQLITE3_MUTEX_INITIALIZER 142 SQLITE3_MUTEX_INITIALIZER
137 }; 143 };
138 sqlite3_mutex *p; 144 sqlite3_mutex *p;
139 switch( iType ){ 145 switch( iType ){
140 case SQLITE_MUTEX_RECURSIVE: { 146 case SQLITE_MUTEX_RECURSIVE: {
141 p = sqlite3MallocZero( sizeof(*p) ); 147 p = sqlite3MallocZero( sizeof(*p) );
142 if( p ){ 148 if( p ){
143 #ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX 149 #ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX
144 /* If recursive mutexes are not available, we will have to 150 /* If recursive mutexes are not available, we will have to
145 ** build our own. See below. */ 151 ** build our own. See below. */
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 pthreadMutexNotheld 347 pthreadMutexNotheld
342 #else 348 #else
343 0, 349 0,
344 0 350 0
345 #endif 351 #endif
346 }; 352 };
347 353
348 return &sMutex; 354 return &sMutex;
349 } 355 }
350 356
351 #endif /* SQLITE_MUTEX_PTHREAD */ 357 #endif /* SQLITE_MUTEX_PTHREADS */
OLDNEW
« no previous file with comments | « third_party/sqlite/sqlite-src-3080704/src/mutex_noop.c ('k') | third_party/sqlite/sqlite-src-3080704/src/mutex_w32.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698