cwMpScNbQueue.h : Added notes to cwMpScNbQueue.h.

This commit is contained in:
kevin 2024-10-14 14:24:14 -04:00
parent 44e39cd429
commit ffda85b4ad

View File

@ -32,6 +32,7 @@ namespace cw
void push( T* payload )
{
// BUG: malloc() isn't non-blocking
node_t* new_node = mem::allocZ<node_t>(1);
new_node->payload = payload;
@ -48,6 +49,10 @@ namespace cw
// 2. Set the old-head next pointer to the new node (thereby adding the new node to the list)
prev->next.store(new_node,std::memory_order_release); // RELEASE 'next' to consumer
// After the first insertion:
// tail -> stub
// stub.next -> new_node
// head -> new_node
}
@ -60,7 +65,7 @@ namespace cw
{
_tail = next;
payload = next->payload;
mem::free(t);
mem::free(t); // BUG: free() isn't non-blocking
}
return payload;