Use lighter atomic counters instead of mutexes

Where appropriate, it makes sense to use lighter weight atomic counters
instead of mutexes.