VirtualBox

Ignore:
Timestamp:
Feb 4, 2008 2:08:02 AM (17 years ago)
Author:
bird
Message:

kAVL: Implemented locking, root node and a direct cache.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/k/kAvlTmpl/kAvlRemoveBestFit.h

    r2 r7  
    3737 *
    3838 * @returns Pointer to the removed node.
    39  * @param   ppTree      Pointer to Pointer to the tree root node.
     39 * @param   pRoot       Pointer to the AVL-tree root structure.
    4040 * @param   Key         The Key of which is to be found a best fitting match for..
    4141 * @param   fAbove      K_TRUE:  Returned node is have the closest key to Key from above.
     
    4646 *          code size, and the likelyhood for bugs.
    4747 */
    48 KAVL_DECL(KAVLNODE *) KAVL_FN(RemoveBestFit)(KAVLTREEPTR *ppTree, KAVLKEY Key, KBOOL fAbove)
     48KAVL_DECL(KAVLNODE *) KAVL_FN(RemoveBestFit)(KAVLROOT *pRoot, KAVLKEY Key, KBOOL fAbove)
    4949{
    5050    /*
     
    5353     * removing the in-tree node as this is way cheaper.
    5454     */
    55     KAVLNODE *pNode = KAVL_FN(GetBestFit)(ppTree, Key, fAbove);
     55    KAVLNODE *pNode = KAVL_FN(GetBestFit)(pRoot, Key, fAbove);
    5656    if (pNode != NULL)
    5757    {
    5858#ifdef KAVL_EQUAL_ALLOWED
     59        KAVL_WRITE_LOCK(pRoot); /** @todo the locking isn't quite sane here. :-/ */
    5960        if (pNode->mpList != KAVL_NULL)
    6061        {
    6162            KAVLNODE *pRet = KAVL_GET_POINTER(&pNode->mpList);
    6263            KAVL_SET_POINTER_NULL(&pNode->mpList, &pRet->mpList);
     64            KAVL_LOOKTHRU_INVALIDATE_NODE(pRoot, pNode, pNode->mKey);
     65            KAVL_WRITE_UNLOCK(pRoot);
    6366            return pRet;
    6467        }
     68        KAVL_WRITE_UNLOCK(pRoot);
    6569#endif
    66         pNode = KAVL_FN(Remove)(ppTree, pNode->mKey);
     70        pNode = KAVL_FN(Remove)(pRoot, pNode->mKey);
    6771    }
    6872    return pNode;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette