dropbox / djinni

A tool for generating cross-language type declarations and interface bindings.
Apache License 2.0
2.88k stars 488 forks source link

EXPERIMENTAL_AUTO_CPP_THREAD_ATTACH - add option to replace use of thread_local with pthread_create_key #454

Closed tndhagedorn closed 4 years ago

tndhagedorn commented 4 years ago

EXPERIMENTAL_AUTO_CPP_THREAD_ATTACH uses a thread_local object's destructor to detach a thread from the JVM on exit - if it was previously attached due to a call across the JNI boudary.

The hooks to run a thread_local object's destructor have compatibility problems on some implementations of Android L's libc, in call to cxa_thread_atexit_impl.

Add new define EXPERIMENTAL_AUTO_CPP_THREAD_ATTACH_NO_THREAD_LOCAL that does the same thing, but using pthread_create_key/pthread_setspecific. This has no dependency on cxa_thread_atexit_impl

tndhagedorn commented 4 years ago

Apologies - please disregard. Bad merge target in PR.