本文整理汇总了C#中Community.CsharpSqlite.sqlite3_mutex类的典型用法代码示例。如果您正苦于以下问题:C# sqlite3_mutex类的具体用法?C# sqlite3_mutex怎么用?C# sqlite3_mutex使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
sqlite3_mutex类属于Community.CsharpSqlite命名空间,在下文中一共展示了sqlite3_mutex类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: counterMutexAlloc
/*
** Allocate a countable mutex
*/
static sqlite3_mutex counterMutexAlloc( int eType )
{
sqlite3_mutex pReal;
sqlite3_mutex pRet = null;
Debug.Assert( g.isInit );
Debug.Assert( eType < 8 && eType >= 0 );
pReal = g.m.xMutexAlloc( eType );
if ( null == pReal )
return null;
if ( eType == SQLITE_MUTEX_FAST || eType == SQLITE_MUTEX_RECURSIVE )
{
pRet = new sqlite3_mutex();
;//(sqlite3_mutex)malloc( sizeof( sqlite3_mutex ) );
}
else
{
pRet = g.aStatic[eType - 2];
}
pRet.eType = eType;
pRet.pReal = pReal;
return pRet;
}
示例2: noopMutexFree
static void noopMutexFree(sqlite3_mutex *p){ return; }
示例3: noopMutexTry
static int noopMutexTry(sqlite3_mutex *p){ return SQLITE_OK; }
示例4: sqlite3_mutex_leave
/*
** 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);
}
}
示例5: Mem0Global
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];
}
示例6: sqlite3_mutex_notheld
static bool sqlite3_mutex_notheld(sqlite3_mutex p) {
return true;
}
示例7: sqlite3_mutex_enter
/*
** 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);
}
}
示例8: counterMutexNotheld
/* Return true if the countable mutex is not currently held */
static bool counterMutexNotheld( sqlite3_mutex p )
{
return g.m.xMutexNotheld( p.pReal );
}
示例9: sqlite3_mutex_held
/*
** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are
** intended for use inside assert() statements.
*/
private static bool sqlite3_mutex_held(sqlite3_mutex p)
{
return p == null || sqlite3GlobalConfig.mutex.xMutexHeld(p);
}
示例10: counterMutexLeave
/* Leave a mutex
*/
static void counterMutexLeave( sqlite3_mutex p )
{
Debug.Assert( g.isInit );
g.m.xMutexLeave( p.pReal );
}
示例11: test_mutex_globals
public sqlite3_mutex[] aStatic = new sqlite3_mutex[6]; /* The six static mutexes */
public test_mutex_globals()
{
for ( int i = 0; i < aStatic.Length; i++ )
aStatic[i] = new sqlite3_mutex();
}
示例12: counterMutexTry
/*
** 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 );
}
示例13: counterMutexEnter
/*
** 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 );
}
示例14: counterMutexFree
/*
** 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);
}
}
示例15: noopMutexHeld
/*
** 2008 October 07
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains the C functions that implement mutexes.
**
** This implementation in this file does not provide any mutual
** exclusion and is thus suitable for use only in applications
** that use SQLite in a single thread. The routines defined
** here are place-holders. Applications can substitute working
** mutex routines at start-time using the
**
** sqlite3_config(SQLITE_CONFIG_MUTEX,...)
**
** interface.
**
** If compiled with SQLITE_DEBUG, then additional logic is inserted
** that does error checking on mutexes to make sure they are being
** called correctly.
*************************************************************************
** Included in SQLite3 port to C#-SQLite; 2008 Noah B Hart
** C#-SQLite is an independent reimplementation of the SQLite software library
**
** SQLITE_SOURCE_ID: 2009-12-07 16:39:13 1ed88e9d01e9eda5cbc622e7614277f29bcc551c
**
*************************************************************************
*/
//#include "sqliteInt.h"
/*
** Stub routines for all mutex methods.
**
** This routines provide no mutual exclusion or error checking.
*/
static int noopMutexHeld(sqlite3_mutex p)
{
return 1;
}