/* ** The sqlite3_mutex_leave() routine exits a mutex that was previously ** entered by the same thread. The behavior is undefined if the mutex ** is not currently entered. If a NULL pointer is passed as an argument ** this function is a no-op. */ static void sqlite3_mutex_leave( sqlite3_mutex p ) { if ( p != null ) { sqlite3GlobalConfig.mutex.xMutexLeave( p ); } }
static bool sqlite3_mutex_notheld( sqlite3_mutex p ) { return ( p == null || sqlite3GlobalConfig.mutex.xMutexNotheld( p ) != 0 ) ; }
/* ** Obtain the mutex p. If some other thread already has the mutex, block ** until it can be obtained. */ static void sqlite3_mutex_enter( sqlite3_mutex p ) { if ( p != null ) { sqlite3GlobalConfig.mutex.xMutexEnter( p ); } }
/* ** Obtain the mutex p. If successful, return SQLITE_OK. Otherwise, if another ** thread holds the mutex and it cannot be obtained, return SQLITE_BUSY. */ static int sqlite3_mutex_try( sqlite3_mutex p ) { int rc = SQLITE_OK; if ( p != null ) { return sqlite3GlobalConfig.mutex.xMutexTry( p ); } return rc; }
static void noopMutexLeave(sqlite3_mutex *p){ return; }
/* ** Free a dynamic mutex. */ static void sqlite3_mutex_free( ref sqlite3_mutex p ) { if ( p != null ) { sqlite3GlobalConfig.mutex.xMutexFree( p ); } }
static int noopMutexTry(sqlite3_mutex *p){ return SQLITE_OK; }
static void noopMutexEnter(sqlite3_mutex *p){ return; }
static void noopMutexFree(sqlite3_mutex *p){ return; }
static int noopMutexNotheld(sqlite3_mutex *p){ return 1; }
public Mem0Global( int nScratchFree, int nPageFree, sqlite3_mutex mutex, sqlite3_int64 alarmThreshold, dxalarmCallback alarmCallback, object alarmArg, int Byte_Allocation, int Int_Allocation, int Mem_Allocation, int BtCursor_Allocation ) { this.nScratchFree = nScratchFree; this.nPageFree = nPageFree; this.mutex = mutex; this.alarmThreshold = alarmThreshold; this.alarmCallback = alarmCallback; this.alarmArg = alarmArg; this.msByte.next = -1; this.msInt.next = -1; this.msMem.next = -1; this.aByteSize = new int[] { 32, 256, 1024, 8192, 0 }; this.aByte_used = new int[] { -1, -1, -1, -1, -1 }; this.aByte = new byte[this.aByteSize.Length][][]; for ( int i = 0; i < this.aByteSize.Length; i++ ) this.aByte[i] = new byte[Byte_Allocation][]; this.aInt = new int[Int_Allocation][]; this.aMem = new Mem[Mem_Allocation <= 4 ? 4 : Mem_Allocation]; this.aBtCursor = new BtCursor[BtCursor_Allocation <= 4 ? 4 : BtCursor_Allocation]; }