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

Progress toward implementation of sqlite3_config() and a rework of the

mutex and memory allocation subsystems.  This is an incremental check-in. (CVS 5218)

FossilOrigin-Name: a03c5af115889f477e17187a198a7d2d40bc76bf
This commit is contained in:
drh
2008-06-13 18:24:27 +00:00
parent 655194d6ae
commit 40257ffd0a
26 changed files with 453 additions and 155 deletions

View File

@@ -11,7 +11,7 @@
*************************************************************************
** This file contains the C functions that implement mutexes for win32
**
** $Id: mutex_w32.c,v 1.6 2008/03/26 18:34:43 danielk1977 Exp $
** $Id: mutex_w32.c,v 1.7 2008/06/13 18:24:27 drh Exp $
*/
#include "sqliteInt.h"
@@ -58,6 +58,12 @@ struct sqlite3_mutex {
#endif /* OS_WINCE */
/*
** Initialize and deinitialize the mutex subsystem.
*/
int sqlite3_mutex_init(void){ return SQLITE_OK; }
int sqlite3_mutex_end(void){ return SQLITE_OK; }
/*
** The sqlite3_mutex_alloc() routine allocates a new
** mutex and returns a pointer to it. If it returns NULL
@@ -161,7 +167,7 @@ void sqlite3_mutex_free(sqlite3_mutex *p){
** more than once, the behavior is undefined.
*/
void sqlite3_mutex_enter(sqlite3_mutex *p){
assert( p );
if( p==0 ) return;
assert( p->id==SQLITE_MUTEX_RECURSIVE || sqlite3_mutex_notheld(p) );
EnterCriticalSection(&p->mutex);
p->owner = GetCurrentThreadId();
@@ -169,7 +175,7 @@ void sqlite3_mutex_enter(sqlite3_mutex *p){
}
int sqlite3_mutex_try(sqlite3_mutex *p){
int rc = SQLITE_BUSY;
assert( p );
if( p==0 ) return SQLITE_OK;
assert( p->id==SQLITE_MUTEX_RECURSIVE || sqlite3_mutex_notheld(p) );
/*
** The sqlite3_mutex_try() routine is very rarely used, and when it
@@ -199,6 +205,7 @@ int sqlite3_mutex_try(sqlite3_mutex *p){
** is not currently allocated. SQLite will never do either.
*/
void sqlite3_mutex_leave(sqlite3_mutex *p){
if( p==0 ) return;
assert( p->nRef>0 );
assert( p->owner==GetCurrentThreadId() );
p->nRef--;