counters: use compiler intrinsics for memory barrier.