fix #16752: threadvar now works with importcpp types; osx now uses native TLS (--tlsEmulation:off), which can be orders of magnitude faster (#16750)
* osx now uses native TLS, which can be orders of magnitude faster
* add {.cppNonPod.}
* improve test
* changelog, docs, disable part of windows test
This commit is contained in:
parent
3c8fddbc76
commit
e112974920
13 changed files with 194 additions and 13 deletions
37
tests/misc/mtlsemulation.h
Normal file
37
tests/misc/mtlsemulation.h
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#include <stdio.h>
|
||||
|
||||
struct Foo1 {
|
||||
/*
|
||||
uncommenting would give:
|
||||
error: initializer for thread-local variable must be a constant expression
|
||||
N_LIB_PRIVATE NIM_THREADVAR Foo1 g1__9brEZhPEldbVrNpdRGmWESA;
|
||||
*/
|
||||
// Foo1() noexcept { }
|
||||
|
||||
/*
|
||||
uncommenting would give:
|
||||
error: type of thread-local variable has non-trivial destruction
|
||||
*/
|
||||
// ~Foo1() { }
|
||||
int x;
|
||||
};
|
||||
|
||||
struct Foo2 {
|
||||
Foo2() noexcept { }
|
||||
~Foo2() { }
|
||||
int x;
|
||||
};
|
||||
|
||||
static int ctorCalls = 0;
|
||||
static int dtorCalls = 0;
|
||||
|
||||
struct Foo3 {
|
||||
Foo3() noexcept {
|
||||
ctorCalls = ctorCalls + 1;
|
||||
x = 10;
|
||||
}
|
||||
~Foo3() {
|
||||
dtorCalls = dtorCalls + 1;
|
||||
}
|
||||
int x;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue