Exemplo n.º 1
0
PlankResult pl_LockFreeQueue_DeInit (PlankLockFreeQueueRef p)
{
    PlankResult result = PlankResult_OK;
    
    if (p == PLANK_NULL)
    {
        result = PlankResult_MemoryError;
        goto exit;
    }
        
    if (pl_LockFreeQueue_GetSize (p) != 0)
    {
        result = PlankResult_ContainerNotEmptyOnDeInit;
        goto exit;
    }
    
    pl_LockFreeQueueElement_DeInit (&p->dummyElement);
    
    pl_AtomicPX_DeInit (&p->head);
    pl_AtomicPX_DeInit (&p->tail);
    pl_MemoryZero (p, sizeof (PlankLockFreeQueue));

exit:
    return result;    
}
PlankResult pl_LockFreeLinkedListElement_DeInit (PlankLockFreeLinkedListElementRef p)
{
    PlankResult result = PlankResult_OK;

    if (p == PLANK_NULL)
    {
        result = PlankResult_MemoryError;
        goto exit;
    }
        
    pl_AtomicPX_DeInit (&p->next);
    pl_AtomicPX_DeInit (&p->data);
    pl_MemoryZero (p, sizeof (PlankLockFreeLinkedListElement));

exit:
    return result;    
}