From c7944fda98cc3a6046932150faf7051564cb43f2 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 3 Jan 2020 14:11:50 +0100 Subject: [PATCH] Blocks tail is already known. --- client/TracyLfq.hpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/client/TracyLfq.hpp b/client/TracyLfq.hpp index abd41c68..c0122e44 100644 --- a/client/TracyLfq.hpp +++ b/client/TracyLfq.hpp @@ -237,15 +237,8 @@ public: } } - void ReleaseBlocks( LfqBlock* blk ) + void ReleaseBlocks( LfqBlock* blk, LfqBlock* blkTail ) { - auto blkTail = blk; - for(;;) - { - auto next = blkTail->next.load(); - if( !next ) break; - blkTail = next; - } auto tail = m_blocksTail.load(); for(;;) { @@ -398,7 +391,8 @@ tracy_force_inline void LfqProducerImpl::CleanupThread() assert( blk ); while( !m_head.compare_exchange_weak( blk, nullptr ) ) {} assert( blk ); - m_queue->ReleaseBlocks( blk ); + auto blkTail = m_tail.load(); + m_queue->ReleaseBlocks( blk, blkTail ); } void LfqProducerImpl::FlushDataImpl()