Beispiel #1
0
        /*
        ** 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);
            }
        }
Beispiel #2
0
 /*
 ** 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));
 }
Beispiel #3
0
 /* Return true if the countable mutex is not currently held */
 static int counterMutexNotheld(_sqlite3_mutex p)
 {
     return(g.m.xMutexNotheld(p.pReal));
 }
Beispiel #4
0
 /* Leave a mutex
  */
 static void counterMutexLeave(_sqlite3_mutex p)
 {
     Debug.Assert(g.isInit);
     g.m.xMutexLeave(p.pReal);
 }
Beispiel #5
0
 /*
 ** 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);
 }
Beispiel #6
0
 /* Return true if the countable mutex is not currently held */
 static int counterMutexNotheld( _sqlite3_mutex p )
 {
   return g.m.xMutexNotheld( p.pReal );
 }
Beispiel #7
0
 /* Leave a mutex
 */
 static void counterMutexLeave( _sqlite3_mutex p )
 {
   Debug.Assert( g.isInit );
   g.m.xMutexLeave( p.pReal );
 }
Beispiel #8
0
 /*
 ** 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 );
 }
Beispiel #9
0
 /*
 ** 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 );
 }
Beispiel #10
0
    /*
    ** 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);
      }
    }