Пример #1
0
PlankResult pl_AtomicLL_Destroy (PlankAtomicLLRef p)
{
    PlankResult result = PlankResult_OK;
    PlankMemoryRef m = pl_MemoryGlobal();

    if ((result = pl_AtomicLL_DeInit (p)) != PlankResult_OK)
        goto exit;
    
    result = pl_Memory_Free (m, p);
exit:
    return result;
}
PlankLockFreeLinkedListElementRef pl_LockFreeLinkedListElement_Create()
{
    PlankMemoryRef m;
    PlankLockFreeLinkedListElementRef p;
    
    m = pl_MemoryGlobal(); // must use the lock free one when done... nope just live with it and use alogrithms that reuse the memory allocs
    p = (PlankLockFreeLinkedListElementRef)pl_Memory_AllocateBytes (m, sizeof (PlankLockFreeLinkedListElement));
    
    if (p != PLANK_NULL)
        pl_MemoryZero (p, sizeof (PlankLockFreeLinkedListElement));
    
    return p;    
}
Пример #3
0
PlankIffFileWriterRef pl_IffFileWriter_Create()
{
    PlankMemoryRef m;
    PlankIffFileWriterRef p;
    
    m = pl_MemoryGlobal();
    p = (PlankIffFileWriterRef)pl_Memory_AllocateBytes (m, sizeof (PlankIffFileWriter));
    
    if (p != PLANK_NULL)
        pl_MemoryZero (p, sizeof (PlankIffFileWriter));
    
    return p;
}
Пример #4
0
PlankSimpleMapRef pl_SimpleMap_Create()
{
    PlankMemoryRef m;
    PlankSimpleMapRef p;
    
    m = pl_MemoryGlobal();
    p = (PlankSimpleMapRef)pl_Memory_AllocateBytes (m, sizeof (PlankSimpleMap));
    
    if (p != PLANK_NULL)
        pl_MemoryZero (p, sizeof (PlankSimpleMap));
    
    return p;
}
Пример #5
0
PlankLockRef pl_Lock_Create()
{
    PlankMemoryRef m;
    PlankLockRef p;
    
    m = pl_MemoryGlobal();
    p = (PlankLockRef)pl_Memory_AllocateBytes (m, sizeof (PlankLock));
    
    if (p != PLANK_NULL)
        pl_MemoryZero (p, sizeof (PlankLock));
    
    return p;
}
Пример #6
0
PlankLockFreeQueueRef pl_LockFreeQueue_Create()
{
    PlankMemoryRef m;
    PlankLockFreeQueueRef p;
    
    m = pl_MemoryGlobal(); // OK, creation of the queue isn't itself lock free
    p = (PlankLockFreeQueueRef)pl_Memory_AllocateBytes (m, sizeof (PlankLockFreeQueue));
    
    if (p != PLANK_NULL)
        pl_MemoryZero (p, sizeof (PlankLockFreeQueue));
    
    return p;
}
PlankResult pl_LockFreeLinkedListElement_Destroy (PlankLockFreeLinkedListElementRef p)
{
    PlankResult result;
    PlankMemoryRef m;
    
    result = PlankResult_OK;
    m = pl_MemoryGlobal();
    
    if ((result = pl_LockFreeLinkedListElement_DeInit (p)) != PlankResult_OK)
        goto exit;
    
    result = pl_Memory_Free (m, p);
    
exit:
    return result;    
}
Пример #8
0
PlankResult pl_SimpleMapElement_Destroy (PlankSimpleMapElementRef p)
{
    PlankResult result = PlankResult_OK;
    PlankMemoryRef m = pl_MemoryGlobal();
    
    if (p == PLANK_NULL)
    {
        result = PlankResult_MemoryError;
        goto exit;
    }
    
    result = pl_Memory_Free (m, p);
    
exit:
    return result;    
}
Пример #9
0
PlankSimpleMapElementRef pl_SimpleMapElement_CreateWithData (const PlankLL key, PlankP ptr)
{
    PlankSimpleMapElementRef p;
    PlankMemoryRef m;

    m = pl_MemoryGlobal();
    p = (PlankSimpleMapElementRef)pl_Memory_AllocateBytes (m, sizeof (PlankSimpleMapElement));
    
    if (p != PLANK_NULL)
    {
        p->key = key;
        p->ptr = ptr;
    }
    
    return p;
}
Пример #10
0
PlankResult pl_SimpleMap_Destroy (PlankSimpleMapRef p)
{
    PlankResult result;
    PlankMemoryRef m;
    
    result = PlankResult_OK;
    m = pl_MemoryGlobal();
    
    if (p == PLANK_NULL)
    {
        result = PlankResult_MemoryError;
        goto exit;
    }
    
    if ((result = pl_SimpleMap_DeInit (p)) != PlankResult_OK)
        goto exit;
    
    result = pl_Memory_Free (m, p);
    
exit:
    return result;    
}
Пример #11
0
PlankResult pl_AtomicI_Destroy (PlankAtomicIRef p)
{
    PlankMemoryRef m = pl_MemoryGlobal();
    return pl_Memory_Free (m, p);
}
Пример #12
0
PlankResult pl_AtomicP_Destroy (PlankAtomicPRef p)
{
    PlankMemoryRef m = pl_MemoryGlobal();
    pl_Memory_Free (m, p);
    return PlankResult_OK;
}