C11 has built-in atomics; we may as well use them to implement atomic_counter_t and speed up a little.