Free empty blocks on thread cleanup.

This commit is contained in:
Bartosz Taudul
2020-01-06 17:04:11 +01:00
parent 41fb476cb0
commit eb6c6a48f5

View File

@@ -454,7 +454,16 @@ tracy_force_inline void LfqProducerImpl::CleanupThread()
auto blk = m_block.load();
assert( blk );
while( !m_block.compare_exchange_weak( blk, nullptr ) ) { YieldThread(); }
m_queue->ReleaseBlock( blk );
auto head = blk->head.load();
auto tail = blk->tail.load();
if( head == tail )
{
m_queue->FreeBlock( blk );
}
else
{
m_queue->ReleaseBlock( blk );
}
}
void LfqProducerImpl::FlushDataImpl()