aboutsummaryrefslogtreecommitdiff
path: root/src/mutex_os2.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2008-06-13 18:24:27 +0000
committerdrh <drh@noemail.net>2008-06-13 18:24:27 +0000
commit40257ffd0a8fd292cd59769d8a1cd5873ae27fbb (patch)
treef369a8f6577d5768cdf1c22355f5984839e51d4f /src/mutex_os2.c
parent655194d6ae6f8fde6184ce5e9d7b0a1965cb4973 (diff)
downloadsqlite-40257ffd0a8fd292cd59769d8a1cd5873ae27fbb.tar.gz
sqlite-40257ffd0a8fd292cd59769d8a1cd5873ae27fbb.zip
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
Diffstat (limited to 'src/mutex_os2.c')
-rw-r--r--src/mutex_os2.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/mutex_os2.c b/src/mutex_os2.c
index ed5477a54..dd1894d24 100644
--- a/src/mutex_os2.c
+++ b/src/mutex_os2.c
@@ -11,7 +11,7 @@
*************************************************************************
** This file contains the C functions that implement mutexes for OS/2
**
-** $Id: mutex_os2.c,v 1.6 2008/03/26 18:34:43 danielk1977 Exp $
+** $Id: mutex_os2.c,v 1.7 2008/06/13 18:24:27 drh Exp $
*/
#include "sqliteInt.h"
@@ -40,6 +40,12 @@ struct sqlite3_mutex {
#define OS2_MUTEX_INITIALIZER 0,0,0,0
/*
+** 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
** that means that a mutex could not be allocated.
@@ -147,7 +153,7 @@ sqlite3_mutex *sqlite3_mutex_alloc(int iType){
** SQLite is careful to deallocate every mutex that it allocates.
*/
void sqlite3_mutex_free(sqlite3_mutex *p){
- assert( p );
+ if( p==0 ) return;
assert( p->nRef==0 );
assert( p->id==SQLITE_MUTEX_FAST || p->id==SQLITE_MUTEX_RECURSIVE );
DosCloseMutexSem( p->mutex );
@@ -169,7 +175,7 @@ void sqlite3_mutex_enter(sqlite3_mutex *p){
TID tid;
PID holder1;
ULONG holder2;
- assert( p );
+ if( p==0 ) return;
assert( p->id==SQLITE_MUTEX_RECURSIVE || sqlite3_mutex_notheld(p) );
DosRequestMutexSem(p->mutex, SEM_INDEFINITE_WAIT);
DosQueryMutexSem(p->mutex, &holder1, &tid, &holder2);
@@ -181,7 +187,7 @@ int sqlite3_mutex_try(sqlite3_mutex *p){
TID tid;
PID holder1;
ULONG holder2;
- assert( p );
+ if( p==0 ) return SQLITE_OK;
assert( p->id==SQLITE_MUTEX_RECURSIVE || sqlite3_mutex_notheld(p) );
if( DosRequestMutexSem(p->mutex, SEM_IMMEDIATE_RETURN) == NO_ERROR) {
DosQueryMutexSem(p->mutex, &holder1, &tid, &holder2);
@@ -205,6 +211,7 @@ void sqlite3_mutex_leave(sqlite3_mutex *p){
TID tid;
PID holder1;
ULONG holder2;
+ if( p==0 ) return;
assert( p->nRef>0 );
DosQueryMutexSem(p->mutex, &holder1, &tid, &holder2);
assert( p->owner==tid );