/* ** Allocate a countable mutex */ //static sqlite3_mutex *counterMutexAlloc(int eType){ // sqlite3_mutex pReal; // sqlite3_mutex pRet = 0; // Debug.Assert( g.isInit ); // Debug.Assert(eType<8 && eType>=0); // pReal = g.m.xMutexAlloc(eType); // if( null==pReal ) return 0; // if( eType==SQLITE_MUTEX_FAST || eType==SQLITE_MUTEX_RECURSIVE ){ // pRet = (sqlite3_mutex *)malloc(sizeof(sqlite3_mutex)); // }else{ // pRet = &g.aStatic[eType-2]; // } // pRet.eType = eType; // pRet.pReal = pReal; // return pRet; //} /* ** Free a countable mutex */ static void counterMutexFree(_sqlite3_mutex p) { Debug.Assert(g.isInit); g.m.xMutexFree(p.pReal); if (p.eType == SQLITE_MUTEX_FAST || p.eType == SQLITE_MUTEX_RECURSIVE) { p = null;//free(p); } }
/* ** Try to enter a mutex. Return true on success. */ static int counterMutexTry(_sqlite3_mutex p) { Debug.Assert(g.isInit); g.aCounter[p.eType]++; if (g.disableTry) { return(SQLITE_BUSY); } return(g.m.xMutexTry(p.pReal)); }
/* Return true if the countable mutex is not currently held */ static int counterMutexNotheld(_sqlite3_mutex p) { return(g.m.xMutexNotheld(p.pReal)); }
/* Leave a mutex */ static void counterMutexLeave(_sqlite3_mutex p) { Debug.Assert(g.isInit); g.m.xMutexLeave(p.pReal); }
/* ** Enter a countable mutex. Block until entry is safe. */ static void counterMutexEnter(_sqlite3_mutex p) { Debug.Assert(g.isInit); g.aCounter[p.eType]++; g.m.xMutexEnter(p.pReal); }
/* Return true if the countable mutex is not currently held */ static int counterMutexNotheld( _sqlite3_mutex p ) { return g.m.xMutexNotheld( p.pReal ); }
/* Leave a mutex */ static void counterMutexLeave( _sqlite3_mutex p ) { Debug.Assert( g.isInit ); g.m.xMutexLeave( p.pReal ); }
/* ** Try to enter a mutex. Return true on success. */ static int counterMutexTry( _sqlite3_mutex p ) { Debug.Assert( g.isInit ); g.aCounter[p.eType]++; if ( g.disableTry ) return SQLITE_BUSY; return g.m.xMutexTry( p.pReal ); }
/* ** Enter a countable mutex. Block until entry is safe. */ static void counterMutexEnter( _sqlite3_mutex p ) { Debug.Assert( g.isInit ); g.aCounter[p.eType]++; g.m.xMutexEnter( p.pReal ); }
/* ** Allocate a countable mutex */ //static sqlite3_mutex *counterMutexAlloc(int eType){ // sqlite3_mutex pReal; // sqlite3_mutex pRet = 0; // Debug.Assert( g.isInit ); // Debug.Assert(eType<8 && eType>=0); // pReal = g.m.xMutexAlloc(eType); // if( null==pReal ) return 0; // if( eType==SQLITE_MUTEX_FAST || eType==SQLITE_MUTEX_RECURSIVE ){ // pRet = (sqlite3_mutex *)malloc(sizeof(sqlite3_mutex)); // }else{ // pRet = &g.aStatic[eType-2]; // } // pRet.eType = eType; // pRet.pReal = pReal; // return pRet; //} /* ** Free a countable mutex */ static void counterMutexFree( _sqlite3_mutex p ) { Debug.Assert( g.isInit ); g.m.xMutexFree( p.pReal ); if ( p.eType == SQLITE_MUTEX_FAST || p.eType == SQLITE_MUTEX_RECURSIVE ) { p = null;//free(p); } }