Add support for reference counting using C11 atomics