Skip to content

Commit 11eb2b1

Browse files
committed
Remove old hack thread_local for macosx
Change-Id: I6d19a6b933d9e38a5e310e2d4dd0f1a97312bc3e Reviewed-on: https://review.couchbase.org/c/kv_engine/+/189928 Tested-by: Build Bot <[email protected]> Reviewed-by: Paolo Cocchi <[email protected]>
1 parent 098a553 commit 11eb2b1

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

engines/ep/src/probabilistic_counter.cc

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,10 @@ static std::uniform_real_distribution<> dis{0.0, 1.0};
1818

1919
// Generate and return a random double value
2020
double ProbabilisticCounterImpl::generateRandom() {
21-
/*
22-
* Use a thread_local random number generator. Based on the
23-
* following: https://stackoverflow.com/a/21238187
24-
*/
25-
#if __APPLE__
2621
/*
27-
* Due to Apple's clang disabling the thread_local keyword
28-
* support we have to have the code below.
29-
* @todo Fixed in XCode 8 (MacOS 10.11.5 / 10.12 or later).
22+
* Use a thread_local random number generator. Based on the
23+
* following: https://stackoverflow.com/a/21238187
3024
*/
31-
static __thread bool seeded = false;
32-
static __thread std::minstd_rand::result_type generatorState = 0;
33-
if (!seeded) {
34-
seeded = true;
35-
generatorState = std::random_device()();
36-
}
37-
std::minstd_rand gen(generatorState);
38-
// Move the generator state forward
39-
generatorState = gen();
40-
#else
4125
static thread_local std::minstd_rand gen{std::random_device()()};
42-
#endif
4326
return dis(gen);
4427
}

0 commit comments

Comments
 (0)