1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Implement the 'CONFIG_SINGLETHREAD' and 'CONFIG_MULTITHREAD' configuration modes. (CVS 5234)

FossilOrigin-Name: 5059644c4bc5f6679afd939e0bc26080f42a9918
This commit is contained in:
danielk1977
2008-06-18 17:09:10 +00:00
parent a2baf3a2e5
commit 59f8c08ecc
24 changed files with 296 additions and 133 deletions

View File

@@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.465 2008/06/17 15:12:01 drh Exp $
** $Id: btree.c,v 1.466 2008/06/18 17:09:10 danielk1977 Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
@@ -1201,7 +1201,7 @@ int sqlite3BtreeOpen(
return SQLITE_NOMEM;
}
sqlite3OsFullPathname(pVfs, zFilename, nFullPathname, zFullPathname);
mutexShared = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MASTER);
mutexShared = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
sqlite3_mutex_enter(mutexShared);
for(pBt=sqlite3SharedCacheList; pBt; pBt=pBt->pNext){
assert( pBt->nRef>0 );
@@ -1298,9 +1298,9 @@ int sqlite3BtreeOpen(
if( p->sharable ){
sqlite3_mutex *mutexShared;
pBt->nRef = 1;
mutexShared = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MASTER);
if( SQLITE_THREADSAFE ){
pBt->mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST);
mutexShared = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
if( SQLITE_THREADSAFE && sqlite3Config.bCoreMutex ){
pBt->mutex = sqlite3MutexAlloc(SQLITE_MUTEX_FAST);
if( pBt->mutex==0 ){
rc = SQLITE_NOMEM;
db->mallocFailed = 0;
@@ -1373,7 +1373,7 @@ static int removeFromSharingList(BtShared *pBt){
int removed = 0;
assert( sqlite3_mutex_notheld(pBt->mutex) );
pMaster = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MASTER);
pMaster = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
sqlite3_mutex_enter(pMaster);
pBt->nRef--;
if( pBt->nRef<=0 ){