Support per-thread is_malloc_allowed() state

Reference issue

#2576 (closed)

What does this implement/fix?

This merge request makes the state of is_malloc_allowed() thread-local, so it can be used in multi-threaded applications without data races.

Additional information

By default, the is_malloc_allowed() state is now thread_local on systems that support it. To disable this behavior, and to use a single global variable instead (e.g. for single-threaded applications), the compiler flag -DEIGEN_AVOID_THREAD_LOCAL=1 can be used.

Merge request reports

Loading