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;    
}
示例#2
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;
}
示例#3
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;
}
示例#4
0
文件: plank_Lock.c 项目: 0x4d52/pl-nk
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;
}
示例#5
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;
}
示例#6
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;
}