< prev index next >

src/hotspot/share/gc/g1/g1DirtyCardQueue.hpp

Print this page
rev 57974 : [mq]: pop_last

*** 75,89 **** HeadTail() : _head(NULL), _tail(NULL) {} HeadTail(BufferNode* head, BufferNode* tail) : _head(head), _tail(tail) {} }; // A lock-free FIFO of BufferNodes, linked through their next() fields. ! // This class has a restriction that pop() cannot return the last buffer ! // in the queue, or what was the last buffer for a concurrent push/append ! // operation. It is expected that there will be a later push/append that ! // will make that buffer available to a future pop(), or there will ! // eventually be a complete transfer via take_all(). class Queue { BufferNode* volatile _head; DEFINE_PAD_MINUS_SIZE(1, DEFAULT_CACHE_LINE_SIZE, sizeof(BufferNode*)); BufferNode* volatile _tail; DEFINE_PAD_MINUS_SIZE(2, DEFAULT_CACHE_LINE_SIZE, sizeof(BufferNode*)); --- 75,86 ---- HeadTail() : _head(NULL), _tail(NULL) {} HeadTail(BufferNode* head, BufferNode* tail) : _head(head), _tail(tail) {} }; // A lock-free FIFO of BufferNodes, linked through their next() fields. ! // This class has a restriction that pop() may return NULL when there are ! // buffers in the queue if there is a concurrent push/append operation. class Queue { BufferNode* volatile _head; DEFINE_PAD_MINUS_SIZE(1, DEFAULT_CACHE_LINE_SIZE, sizeof(BufferNode*)); BufferNode* volatile _tail; DEFINE_PAD_MINUS_SIZE(2, DEFAULT_CACHE_LINE_SIZE, sizeof(BufferNode*));
*** 103,115 **** // Thread-safe add the buffers from first to last to the end of the queue. void append(BufferNode& first, BufferNode& last); // Thread-safe attempt to remove and return the first buffer in the queue. ! // Returns NULL if the queue is empty, or if only one buffer is found. ! // Uses GlobalCounter critical sections to address the ABA problem; this ! // works with the buffer allocator's use of GlobalCounter synchronization. BufferNode* pop(); // Take all the buffers from the queue, leaving the queue empty. // Not thread-safe. HeadTail take_all(); --- 100,113 ---- // Thread-safe add the buffers from first to last to the end of the queue. void append(BufferNode& first, BufferNode& last); // Thread-safe attempt to remove and return the first buffer in the queue. ! // Returns NULL if the queue is empty, or if a concurrent push/append ! // interferes. Uses GlobalCounter critical sections to address the ABA ! // problem; this works with the buffer allocator's use of GlobalCounter ! // synchronization. BufferNode* pop(); // Take all the buffers from the queue, leaving the queue empty. // Not thread-safe. HeadTail take_all();
< prev index next >