Small algorithm improvements to avoid allocations
TL depends on cppcoro now
This commit is contained in:
+2
-2
@@ -113,7 +113,7 @@ extern thread_local int32_t s_ptr_checking_disabled;
|
||||
#define CB_LENT_DEC_REF() \
|
||||
if (m_cb) [[likely]] \
|
||||
{ \
|
||||
bool is_dangling = m_cb->unique_count.load(tl::memory_order_acquire) == 0; \
|
||||
const bool is_dangling = m_cb->unique_count.load(tl::memory_order_acquire) == 0; \
|
||||
if (is_dangling && is_ptr_checking_enabled()) [[unlikely]] \
|
||||
TL_FAIL("lent: {} dangling lent ptrs detected", m_cb->lent_count.load(tl::memory_order_acquire)); \
|
||||
if (m_cb->lent_count.fetch_sub(1, tl::memory_order_acquire) == 1) /* last one? cleanup */ \
|
||||
@@ -144,7 +144,7 @@ extern thread_local int32_t s_ptr_checking_disabled;
|
||||
#define CB_UNIQUE_DEC_REF() \
|
||||
if (m_cb && m_cb->unique_count.fetch_sub(1, tl::memory_order_acquire) == 1) [[likely]] \
|
||||
{ \
|
||||
int32_t count = m_cb->lent_count.load(tl::memory_order_acquire); \
|
||||
const int32_t count = m_cb->lent_count.load(tl::memory_order_acquire); \
|
||||
if (count == 0) [[likely]] \
|
||||
delete m_cb; \
|
||||
else if (is_ptr_checking_enabled()) [[likely]] \
|
||||
|
||||
Reference in New Issue
Block a user