In one of my projects that uses Avro, I pass avro_datum_t instances between threads, using the reference count mechanism to make sure that they're not freed while any thread still has a reference to them. I was getting some spurious segfaults, which were caused by the fact that the reference counts aren't updated atomically. I've created a patch that implements atomic reference counts, using the OpenPA library to provide the atomic operations themselves. (That library is MIT licensed, so it can be included in the source tree.)
Note that only avro_XXX_incref and avro_XXX_decref are thread-safe as a result of this patch. For all of the other library functions, the caller is still responsible for ensuring thread safety.
The patch makes sure that the OpenPA code works in both the old autotools build and the newer CMake build.