On 24 December 2011 11:46, Bart Van Assche wrote: > > 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.
I think the cost of checking that on every ref-count update would be too high for the vast majority of users who don't use race detectors. A macro has zero cost if it's not used, and even people using race detectors don't want them enabled all the time. As I said, you don't need to recompile the whole library to instrument the parts that are affected, only specific objects. I think the right thing to do is identify the parts that need to be recompiled and document how to do just that.