ywkaras commented on a change in pull request #7362:
URL: https://github.com/apache/trafficserver/pull/7362#discussion_r534617439
##########
File path: src/tscore/ink_queue.cc
##########
@@ -66,6 +67,139 @@
#define DEADBEEF
#endif
+namespace
+{
+// Atomic stack, implemented as a linked list. The link is stored at the
offset (given by the base class
+// member function link_offset() ) within each stack element. The stack is
empty when the head pointer is null.
+//
+template <class Base> class AtomicStack_ : private Base
+{
+public:
+ template <typename... Args>
+ AtomicStack_(std::atomic<void *> &head, Args &&... args) :
Base(std::forward<Args>(args)...), _head(head)
+ {
+ }
+
+ // Return reference to "next" pointer within a stack element.
+ //
+ void *&
+ link(void *elem)
+ {
+ return *reinterpret_cast<void **>(static_cast<char *>(elem) +
Base::link_offset());
+ }
+
+ // Splice this stack to the tail of another stack (whose head and tail is
given by the parameters).
Review comment:
are given
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]