ptr_ += size;
}
-
} // namespace
void Random::secureRandom(void* data, size_t size) {
- static ThreadLocal<BufferedRandomDevice> bufferedRandomDevice;
- bufferedRandomDevice->get(data, size);
+ static thread_local BufferedRandomDevice bufferedRandomDevice;
+ bufferedRandomDevice.get(data, size);
}
-ThreadLocalPRNG::ThreadLocalPRNG() {
- static folly::ThreadLocal<ThreadLocalPRNG::LocalInstancePRNG> localInstance;
- local_ = localInstance.get();
-}
class ThreadLocalPRNG::LocalInstancePRNG {
public:
Random::DefaultGenerator rng;
};
+ThreadLocalPRNG::ThreadLocalPRNG() {
+ static thread_local ThreadLocalPRNG::LocalInstancePRNG localInstance;
+ local_ = &localInstance;
+}
+
uint32_t ThreadLocalPRNG::getImpl(LocalInstancePRNG* local) {
return local->rng();
}