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

fix un-threadsafe code for creating config enum hashtable. #6475

Closed

Conversation

supermerill
Copy link
Contributor

@supermerill supermerill commented May 2, 2021

Hello

Someone had a random bug.
I tracked it to the initialisation of the config enum.
Some of them are thread-safe and some don't, so I put all of them to be thread-safe.
Same for the serialize() that wasn't thread-safe (imo).

I hope I didn't add a typo in the last edit.

bubnikv added a commit that referenced this pull request May 4, 2021
fix un-threadsafe code for creating config enum hashtable. #6475
@bubnikv
Copy link
Collaborator

bubnikv commented May 4, 2021

Thanks for pointing that out. It may have been a problem. Fixed with a7368b9.

The static tables are now initialized statically. Comparing to a static variable inside a function, static variable outside of a function does not require the compiler generated synchronization primitive (which is a bit costly because it flushes write caches on Intel CPUs every time the function is visited), however order of initialization of static variables is not defined between compilation units.

Also the get_enum_names() are statically generated as well.

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

Successfully merging this pull request may close these issues.

None yet

2 participants