On Sat, Dec 24, 2011 at 11:15 AM, Jonathan Wakely <jwakely....@gmail.com> wrote: > On 24 December 2011 11:11, Jonathan Wakely wrote: >> Apart from that, I prefer to keep the thread-launching logic in the >> library rather than headers, as it allows us to change it more easily >> and for users to benefit just by linking to a newer library rather >> than recompiling. I don't think the data race detection macros are a >> compelling reason to change that. > > An example improvement (which I'm working on) is to give better stack > traces when a process is terminated by an uncaught exception in a > function run by std::thread. If that's improved in the library, all > existing code using std::thread would get better stack traces just by > linking to a newer libstdc++.so, rather than having to recompile with > a newer GCC.
Would it be acceptable to replace the _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE() and ..._AFTER() macros by something like this: if (pf) (*pf)(addr, before_or_after_flag) where pf is a function pointer that is NULL by default and can be set by libstdc++ users. That approach would also avoid that libstdc++ has to be recompiled in order to instrument reference count decrementing for data race detectors. Bart.