Commit b7e1694c authored by Andrew Gallagher's avatar Andrew Gallagher Committed by Facebook Github Bot

folly/experimental/hazptr: mark static local as "library-local"

Summary:
When using `-fvisibility-inlines-hidden` or using C/C++ shared libs
transitively from a Python binary, static locals in inline functions
can potentially have more than one definition at runtime.  This diff
explicitly marks this static local as safe for this scenario.

Reviewed By: djwatson

Differential Revision: D4082831

fbshipit-source-id: 75616ac26a39f44691ef59b889ea555e9daa391b
parent 94e96497
...@@ -48,7 +48,8 @@ memory_resource* new_delete_resource(); ...@@ -48,7 +48,8 @@ memory_resource* new_delete_resource();
#include <folly/experimental/hazptr/debug.h> #include <folly/experimental/hazptr/debug.h>
inline memory_resource** default_mr_ptr() { inline memory_resource** default_mr_ptr() {
static memory_resource* default_mr = new_delete_resource(); /* library-local */ static memory_resource* default_mr =
new_delete_resource();
DEBUG_PRINT(&default_mr << " " << default_mr); DEBUG_PRINT(&default_mr << " " << default_mr);
return &default_mr; return &default_mr;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment