From ffda85b4ad5dc87f6d68043463b51bf895cf8c34 Mon Sep 17 00:00:00 2001 From: kevin Date: Mon, 14 Oct 2024 14:24:14 -0400 Subject: [PATCH] cwMpScNbQueue.h : Added notes to cwMpScNbQueue.h. --- cwMpScNbQueue.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cwMpScNbQueue.h b/cwMpScNbQueue.h index 0e481de..2e86c73 100644 --- a/cwMpScNbQueue.h +++ b/cwMpScNbQueue.h @@ -32,6 +32,7 @@ namespace cw void push( T* payload ) { + // BUG: malloc() isn't non-blocking node_t* new_node = mem::allocZ(1); new_node->payload = payload; @@ -47,7 +48,11 @@ 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;