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

Thread safety of any.h #290

Open
newstzpz opened this issue Apr 15, 2016 · 1 comment
Open

Thread safety of any.h #290

newstzpz opened this issue Apr 15, 2016 · 1 comment

Comments

@newstzpz
Copy link

The following code in https://github.com/mariusmuja/flann/blob/master/src/cpp/flann/util/any.h is not thread safe in MSVC until VS 2015 ("Magic statics" support in https://msdn.microsoft.com/en-us/library/hh567368.aspx). This may crash the program randomly when creating multiple Index objects (KDTreeSingleIndex etc.) at the same time.

/// This function will return a different policy for each type. template<typename T> base_any_policy* get_policy() { static typename choose_policy<T>::type policy; return &policy; }

@victl
Copy link

victl commented Dec 24, 2018

In case any one also run into this issue, I found the solution to be this one

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

2 participants