当前位置: 首页>>代码示例>>C#>>正文


C# Pager.xBusyHandler方法代码示例

本文整理汇总了C#中Community.CsharpSqlite.Pager.xBusyHandler方法的典型用法代码示例。如果您正苦于以下问题:C# Pager.xBusyHandler方法的具体用法?C# Pager.xBusyHandler怎么用?C# Pager.xBusyHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Community.CsharpSqlite.Pager的用法示例。


在下文中一共展示了Pager.xBusyHandler方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: pager_wait_on_lock

    /*
    ** Try to obtain a lock of type locktype on the database file. If
    ** a similar or greater lock is already held, this function is a no-op
    ** (returning SQLITE_OK immediately).
    **
    ** Otherwise, attempt to obtain the lock using sqlite3OsLock(). Invoke
    ** the busy callback if the lock is currently not available. Repeat
    ** until the busy callback returns false or until the attempt to
    ** obtain the lock succeeds.
    **
    ** Return SQLITE_OK on success and an error code if we cannot obtain
    ** the lock. If the lock is obtained successfully, set the Pager.state
    ** variable to locktype before returning.
    */
    static int pager_wait_on_lock( Pager pPager, int locktype )
    {
      int rc;                              /* Return code */

      /* The OS lock values must be the same as the Pager lock values */
      Debug.Assert( PAGER_SHARED == SHARED_LOCK );
      Debug.Assert( PAGER_RESERVED == RESERVED_LOCK );
      Debug.Assert( PAGER_EXCLUSIVE == EXCLUSIVE_LOCK );

      /* If the file is currently unlocked then the size must be unknown. It
      ** must not have been modified at this point.
      */
      Debug.Assert( pPager.state >= PAGER_SHARED || pPager.dbSizeValid == false );
      Debug.Assert( pPager.state >= PAGER_SHARED || pPager.dbModified == false );

      /* Check that this is either a no-op (because the requested lock is
      ** already held, or one of the transistions that the busy-handler
      ** may be invoked during, according to the comment above
      ** sqlite3PagerSetBusyhandler().
      */
      Debug.Assert( ( pPager.state >= locktype )
      || ( pPager.state == PAGER_UNLOCK && locktype == PAGER_SHARED )
      || ( pPager.state == PAGER_RESERVED && locktype == PAGER_EXCLUSIVE )
      );

      if ( pPager.state >= locktype )
      {
        rc = SQLITE_OK;
      }
      else
      {
        do
        {
          rc = sqlite3OsLock( pPager.fd, locktype );
        } while ( rc == SQLITE_BUSY && pPager.xBusyHandler( pPager.pBusyHandlerArg ) != 0 );
        if ( rc == SQLITE_OK )
        {
          pPager.state = (u8)locktype;
          IOTRACE( "LOCK %p %d\n", pPager, locktype );
        }
      }
      return rc;
    }
开发者ID:Belxjander,项目名称:Asuna,代码行数:57,代码来源:pager_c.cs

示例2: pager_wait_on_lock

        /*
        ** Try to obtain a lock of type locktype on the database file. If
        ** a similar or greater lock is already held, this function is a no-op
        ** (returning SQLITE_OK immediately).
        **
        ** Otherwise, attempt to obtain the lock using sqlite3OsLock(). Invoke
        ** the busy callback if the lock is currently not available. Repeat
        ** until the busy callback returns false or until the attempt to
        ** obtain the lock succeeds.
        **
        ** Return SQLITE_OK on success and an error code if we cannot obtain
        ** the lock. If the lock is obtained successfully, set the Pager.state
        ** variable to locktype before returning.
        */
        static int pager_wait_on_lock( Pager pPager, int locktype )
        {
            int rc;                              /* Return code */

              /* Check that this is either a no-op (because the requested lock is
              ** already held, or one of the transistions that the busy-handler
              ** may be invoked during, according to the comment above
              ** sqlite3PagerSetBusyhandler().
              */
              Debug.Assert( ( pPager.eLock >= locktype )
              || ( pPager.eLock == NO_LOCK && locktype == SHARED_LOCK )
              || ( pPager.eLock == RESERVED_LOCK && locktype == EXCLUSIVE_LOCK )
              );

              do
              {
            rc = pagerLockDb( pPager, locktype );
              } while ( rc == SQLITE_BUSY && pPager.xBusyHandler( pPager.pBusyHandlerArg ) != 0 );
              return rc;
        }
开发者ID:taxilian,项目名称:some_library,代码行数:34,代码来源:pager_c.cs


注:本文中的Community.CsharpSqlite.Pager.xBusyHandler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。