Пример #1
0
        public PgHdr pPgHdr = new PgHdr();  // Pointer to Actual Page Header

        public void Clear()
        {
            this.iKey = 0;
            this.pNext = null;
            this.pCache = null;
            this.pPgHdr.ClearState();
        }
Пример #2
0
        public PgHdr pPgHdr = new PgHdr();  // Pointer to Actual Page Header

        public void Clear()
        {
            this.iKey   = 0;
            this.pNext  = null;
            this.pCache = null;
            this.pPgHdr.ClearState();
        }
Пример #3
0
        public static IPCache xCreate(int szPage, bool bPurgeable)
        {
            // The seperateCache variable is true if each PCache has its own private PGroup.  In other words, separateCache is true for mode (1) where no
            // mutexing is required.
            //   *  Always use a unified cache (mode-2) if ENABLE_MEMORY_MANAGEMENT
            //   *  Always use a unified cache in single-threaded applications
            //   *  Otherwise (if multi-threaded and ENABLE_MEMORY_MANAGEMENT is off) use separate caches (mode-1)
#if SQLITE_ENABLE_MEMORY_MANAGEMENT || !SQLITE_THREADSAF
            const int separateCache = 0;
#else
            int separateCache = sqlite3GlobalConfig.bCoreMutex > 0;
#endif
            var pCache = new PCache1();
            {
                PGroup pGroup;       // The group the new page cache will belong to
                if (separateCache != 0)
                {
                    //pGroup = new PGroup();
                    //pGroup.mxPinned = 10;
                }
                else
                {
                    pGroup = pcache1.grp;
                }
                pCache.pGroup     = pGroup;
                pCache.szPage     = szPage;
                pCache.bPurgeable = bPurgeable;
                if (bPurgeable)
                {
                    pCache.nMin = 10;
                    pcache1EnterMutex(pGroup);
                    pGroup.nMinPage += (int)pCache.nMin;
                    pGroup.mxPinned  = pGroup.nMaxPage + 10 - pGroup.nMinPage;
                    pcache1LeaveMutex(pGroup);
                }
            }
            return((IPCache)pCache);
        }
Пример #4
0
 public static IPCache xCreate(int szPage, bool bPurgeable)
 {
     // The seperateCache variable is true if each PCache has its own private PGroup.  In other words, separateCache is true for mode (1) where no
     // mutexing is required.
     //   *  Always use a unified cache (mode-2) if ENABLE_MEMORY_MANAGEMENT
     //   *  Always use a unified cache in single-threaded applications
     //   *  Otherwise (if multi-threaded and ENABLE_MEMORY_MANAGEMENT is off) use separate caches (mode-1)
     #if SQLITE_ENABLE_MEMORY_MANAGEMENT || !SQLITE_THREADSAF
     const int separateCache = 0;
     #else
     int separateCache = sqlite3GlobalConfig.bCoreMutex > 0;
     #endif
     var pCache = new PCache1();
     {
         PGroup pGroup;       // The group the new page cache will belong to
         if (separateCache != 0)
         {
             //pGroup = new PGroup();
             //pGroup.mxPinned = 10;
         }
         else
             pGroup = pcache1.grp;
         pCache.pGroup = pGroup;
         pCache.szPage = szPage;
         pCache.bPurgeable = bPurgeable;
         if (bPurgeable)
         {
             pCache.nMin = 10;
             pcache1EnterMutex(pGroup);
             pGroup.nMinPage += (int)pCache.nMin;
             pGroup.mxPinned = pGroup.nMaxPage + 10 - pGroup.nMinPage;
             pcache1LeaveMutex(pGroup);
         }
     }
     return (IPCache)pCache;
 }
Пример #5
0
 private static PgHdr1 PAGE_TO_PGHDR1(PCache1 c, PgHdr p)
 {
     return((PgHdr1)p.PgHdr1);
 }
Пример #6
0
 private static PgHdr1 PAGE_TO_PGHDR1(PCache1 c, PgHdr p)
 {
     return (PgHdr1)p.PgHdr1;
 }