Commit a4eda9d3 authored by Subodh Iyengar's avatar Subodh Iyengar Committed by dcsommer

Remove global init of ThreadLocal in Random

Summary:
Remove global initialization of ThreadLocal in Random
See https://gcc.gnu.org/onlinedocs/gcc-4.8.3/gcc/Thread-Local.html

Static initializers and thread locals don't mix well, and we're seeing
some crashes which we think might be related to this.

Test Plan: Unit tests

Reviewed By: seanc@fb.com

Subscribers: trunkagent, seanc, njormrod

FB internal diff: D1617455
parent 187cf0a0
...@@ -90,11 +90,11 @@ void BufferedRandomDevice::getSlow(unsigned char* data, size_t size) { ...@@ -90,11 +90,11 @@ void BufferedRandomDevice::getSlow(unsigned char* data, size_t size) {
ptr_ += size; ptr_ += size;
} }
ThreadLocal<BufferedRandomDevice> bufferedRandomDevice;
} // namespace } // namespace
void Random::secureRandom(void* data, size_t size) { void Random::secureRandom(void* data, size_t size) {
static ThreadLocal<BufferedRandomDevice> bufferedRandomDevice;
bufferedRandomDevice->get(data, size); bufferedRandomDevice->get(data, size);
} }
......
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