2017-01-27 15:29:38 UTC
i am debugging an application where several shared libraries contain statically-linked copies of boost::thread (and other boost components). this means the static part of boost::thread is multiple times present in the process.
on macos (apple clang 7.3) we see rare (but reproducible) access violations caused by boost::thread_specific_ptr::get() unexpectedly returning nullptr. if we enable assertions we get an assert in thread.cpp:151
if we dynamically link boost the problems go away. i can superficially understand that linking only one "common" instance of boost::thread is "more safe".
what could be the explanation for this observation? is this setup even supported? one theory is that the implementations in pthread/thread_heap_alloc.hpp interfere with each other...
the specific line where we get an unexpected nullptr (actually a bad reference) is here:
the definition of CGAL_STATIC_THREAD_LOCAL_VARIABLE is here?:
boost version is 1.59
Simon Haegler | Software Engineer
Esri R&D Center Zurich | Foerrlibuckstrasse 110 | 8005 Zurich | Switzerland
T +41 44 204 60 80 | ***@esri.com