Replace __sync_fetch_and_add with call to and_atomicptr