Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] how to prevent multithread problem in chunk_alloctor? #211

Open
gggin opened this issue Nov 27, 2023 · 1 comment
Open

[Question] how to prevent multithread problem in chunk_alloctor? #211

gggin opened this issue Nov 27, 2023 · 1 comment

Comments

@gggin
Copy link

gggin commented Nov 27, 2023

  1. chunk_allocator allocate function change last pointer when memory need be allocate
  2. chunk_allocator invert function will be called in serialize function and also use last->prev and last pointer

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?

@gggin gggin changed the title [Question] how to prevent multithread problem? [Question] how to prevent multithread problem in chunk_alloctor? Nov 27, 2023
@gggin
Copy link
Author

gggin commented Mar 5, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant