mirror of
https://github.com/boostorg/config.git
synced 2025-08-03 22:34:27 +02:00
Enhance thread_local tests.
Try to reproduce issues: https://github.com/libbitcoin/libbitcoin/issues/733#issuecomment-301652210 https://github.com/boostorg/multiprecision/issues/20
This commit is contained in:
@@ -14,10 +14,22 @@
|
||||
|
||||
namespace boost_no_cxx11_thread_local{
|
||||
|
||||
template <class T>
|
||||
int check_local(int n)
|
||||
{
|
||||
static thread_local T s(n, ' ');
|
||||
static thread_local int size = s.size();
|
||||
if(size != n)
|
||||
{
|
||||
s = T(n, ' ');
|
||||
size = n;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
int test()
|
||||
{
|
||||
static thread_local std::string local("hello");
|
||||
return 0;
|
||||
return check_local<std::string>(5) == 5 ? 0 : 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user