Lock-free queue with doubly linked list correctness
C11 atomic library

I you want to avoid the "legacy" functions, one solution would be to use the C11 atomic operations library. It is not widely supported yet. I know that GCC has been working on it, but I don't know if the 4.9 release already implements all the operations. Anyway, had you a compliant compiler, you could use standard atomic types and atomic operations.

For example, here are your functions ckLinkedListPushBack and ckLinkedListPopFront rewritten with the C11 atomic module:

void ckLinkedListPushBack(LinkedList *pList, void *pNode)
{
    atomic_fetch_add(&amp;pList-&gt;size, 1);

    LinkedListNode *dummy = &amp;pList-&gt;dummy;

    LinkedListNode *ptr = (LinkedListNode *)pNode;
    LinkedListNode *tail;

    ptr-&gt;pNext = dummy;

    while (1)
    {
        tail = dummy-&gt;pPrev;
        ptr-&gt;pPrev = tail;
        if (atomic_compare_exchange_strong(&amp;dummy-&gt;pPrev, tail, ptr))
        {
            tail-&gt;pNext = ptr;
            break;
        }
    }
}

LinkedListNode *ckLinkedListPopFront(LinkedList *pList)
{
    LinkedListNode *dummy = &amp;pList-&gt;dummy;

    LinkedListNode *ptr, *next, *dnext;

    ptr = dummy-&gt;pNext;
    if (ptr == dummy)
    {
        return NULL;
    }

    while (1)
    {
        next = ptr-&gt;pNext;
        if (atomic_compare_exchange_strong(&amp;next-&gt;pPrev, ptr, dummy))
        {
            dnext = dummy-&gt;pNext;
            atomic_compare_exchange_strong(&amp;dummy-&gt;pNext, dnext, next);
            break;
        }
    }

    atomic_fetch_sub(&amp;pList-&gt;size, 1);
    return ptr;
}


In order for it to work, you would have to declare size to be an instance of atomic_uint_least32_t (fixed size types are not provided for atomics).

typedef struct

You can make clearer the LinkedListNode declaration by separating the typedef from the actual declaration:

typedef struct tagLinkedListNode LinkedListNode;

struct tagLinkedListNode 
{
    LinkedListNode * volatile pNext;
    LinkedListNode * volatile pPrev;
};