easy_profiler
easy_profiler copied to clipboard
[Question] how to prevent multithread problem in chunk_alloctor?
- chunk_allocator allocate function change
lastpointer when memory need be allocate - chunk_allocator
invertfunction will be called inserializefunction and also uselast->prevandlastpointer
Question1: 1 and 2 will cause multithread problem? Question2: if Question 1 is true, where is code to handle this, or this is a bug?
After some survey I find:
ProfileManager::dumpBlocksToStream function will set
m_profilerStatus.store(false, std::memory_order_release); that isEnable be setted into false
and every endBlock function will check this atomic variable and then give all endBlock 20ms to finish calls
so endBlock 's call chunk_allocator's allocate function will never call with serialize function