示例#1
0
文件: dbm_quick.c 项目: awsiv/core
DBCursorPriv *DBPrivOpenCursor(DBPriv *db)
{
    if (!LockCursor(db))
    {
        return NULL;
    }

    if (!Lock(db))
    {
        UnlockCursor(db);
        return NULL;
    }

    if (!dpiterinit(db->depot))
    {
        Log(LOG_LEVEL_ERR, "Could not initialize QuickDB iterator. (dpiterinit: %s)", dperrmsg(dpecode));
        Unlock(db);
        UnlockCursor(db);
        return NULL;
    }

    DBCursorPriv *cursor = xcalloc(1, sizeof(DBCursorPriv));
    cursor->db = db;

    Unlock(db);

    /* Cursor remains locked */
    return cursor;
}
示例#2
0
void CRectangleDrawer::OnLButtonDown(UINT nFlags, CPoint point)
{
    if ( m_bDrawing )
    {
        // Log
        //TRACE( CString(L"m_bIsStartDraw is True! function name is ") + __FUNCDNAME__ );
    }

    CRect Rect;
    GetClientRect(&Rect);
    ClientToScreen(&Rect);

    if ( m_bIsOK )
    {
        if ( IsDargPoint(point) )
        {
            LockCursor(Rect);
            m_bDragging = true;
            return;
        }
        else if ( (m_nDragDir = IsDargPoint2(point)) != NO_Darg )
        {
            m_bDragging = false;
            LockCursor(Rect);
            return;
        }
        else if ( IsDargCenterPoint(point) )
        {
            m_bDragging = false;
            LockCursor(Rect);
            m_bDragCenter = true;
            return;
        }

        m_bDragging = false;
        return;
    }

    LockCursor(Rect);
    m_bIsOK = m_bDrawing = true;
    m_PointQueue[0] = m_PointQueue[1] =
        m_PointQueue[2] = m_PointQueue[3] = point;
    ParentInvalidate();
}
示例#3
0
/*
 * This one has to be locked against cursor -- deleting entries might interrupt
 * iteration.
 */
bool DBPrivDelete(DBPriv *db, const void *key, int key_size)
{
    if (!LockCursor(db))
    {
        return false;
    }

    int ret = Delete(db->hdb, key, key_size);

    UnlockCursor(db);
    return ret;
}
示例#4
0
DBCursorPriv *DBPrivOpenCursor(DBPriv *db)
{
    if (!LockCursor(db))
    {
        return false;
    }

    DBCursorPriv *cursor = xcalloc(1, sizeof(DBCursorPriv));
    cursor->db = db;

    /* Cursor remains locked */
    return cursor;
}