rm5248 commented on code in PR #335:
URL: https://github.com/apache/logging-log4cxx/pull/335#discussion_r1464097310


##########
src/main/cpp/asyncappender.cpp:
##########
@@ -96,6 +96,59 @@ typedef std::map<LogString, DiscardSummary> DiscardMap;
 }
 #endif
 
+#define USE_ATOMIC_QUEUE 1
+#if USE_ATOMIC_QUEUE
+#include <atomic>
+namespace
+{
+static const int CACHE_LINE_SIZE = 128;
+class AtomicQueue
+{
+public:
+       struct alignas(CACHE_LINE_SIZE) Node
+       {
+               LoggingEventPtr data;
+               Node* next;
+               Node(const LoggingEventPtr& event, Node* n)
+                       : data(event)
+                       , next(n)
+               { }
+       };
+
+       AtomicQueue() : m_head(0) {}
+
+       void push(const LoggingEventPtr& event)
+       {
+               auto n = new Node(event, 
m_head.load(std::memory_order_relaxed));

Review Comment:
   I don't see a corresponding `delete` anyplace, am I missing it?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to