cwMpScNbQueue.h : Added notes to cwMpScNbQueue.h.
This commit is contained in:
parent
44e39cd429
commit
ffda85b4ad
@ -32,6 +32,7 @@ namespace cw
|
|||||||
|
|
||||||
void push( T* payload )
|
void push( T* payload )
|
||||||
{
|
{
|
||||||
|
// BUG: malloc() isn't non-blocking
|
||||||
node_t* new_node = mem::allocZ<node_t>(1);
|
node_t* new_node = mem::allocZ<node_t>(1);
|
||||||
|
|
||||||
new_node->payload = payload;
|
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)
|
// 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
|
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;
|
_tail = next;
|
||||||
payload = next->payload;
|
payload = next->payload;
|
||||||
mem::free(t);
|
mem::free(t); // BUG: free() isn't non-blocking
|
||||||
}
|
}
|
||||||
|
|
||||||
return payload;
|
return payload;
|
||||||
|
Loading…
Reference in New Issue
Block a user