MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / free_thread_data

Method free_thread_data

extern/libcds/src/dhp.cpp:311–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

309 }
310
311 CDS_EXPORT_API void smr::free_thread_data( thread_record* pRec, bool callHelpScan )
312 {
313 assert( pRec != nullptr );
314 //CDS_HAZARDPTR_STATISTIC( ++m_Stat.m_RetireHPRec )
315
316 pRec->hazards_.clear();
317 scan( pRec );
318
319 if ( callHelpScan )
320 help_scan( pRec );
321
322 if ( pRec->retired_.empty()) {
323 pRec->retired_.fini();
324 pRec->free_.store( true, std::memory_order_release );
325 }
326 else {
327 // Free all empty blocks
328 retired_block* free_block = pRec->retired_.current_block_->next_;
329 if ( free_block ) {
330 pRec->retired_.current_block_->next_ = nullptr;
331 while ( free_block ) {
332 retired_block* next = free_block->next_;
333 retired_allocator_.free( free_block );
334 free_block = next;
335 --pRec->retired_.block_count_;
336 }
337 }
338 }
339
340 pRec->thread_id_.store( cds::OS::c_NullThreadId, atomics::memory_order_release );
341 }
342
343 namespace {
344 typedef std::vector<void*, allocator<void*>> hp_vector;

Callers 1

detach_threadMethod · 0.45

Calls 7

assertClass · 0.85
scanFunction · 0.85
clearMethod · 0.45
emptyMethod · 0.45
finiMethod · 0.45
storeMethod · 0.45
freeMethod · 0.45

Tested by

no test coverage detected