1 // Copyright John Maddock, 2021
2 // Use, modification and distribution are subject to the
3 // Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt
5 // or copy at http://www.boost.org/LICENSE_1_0.txt)
7 #include <boost/math/tools/config.hpp>
9 #if !defined(BOOST_MATH_NO_THREAD_LOCAL_WITH_NON_TRIVIAL_TYPES) && defined(BOOST_HAS_THREADS)
18 std::atomic
<int> counter
{ 0 };
23 static thread_local
std::vector
<double> list
;
25 std::default_random_engine rnd
;
26 std::uniform_real_distribution
<> dist
;
28 for (unsigned i
= 0; i
< 1000; ++i
)
30 list
.push_back(dist(rnd
));
33 std::sort(list
.begin(), list
.end());
38 std::thread
f1(thread_proc
);
39 std::thread
f2(thread_proc
);
40 std::thread
f3(thread_proc
);
41 std::thread
f4(thread_proc
);
42 std::thread
f5(thread_proc
);
43 std::thread
f6(thread_proc
);
52 std::cout
<< "Counter value was: " << counter
<< std::endl
;
54 return counter
- 6000;
59 int main() { return 0; }