Daily iOS
Concurrency

Race conditions

This code gets called from several threads, and count comes out lower than expected. Can you explain why at the CPU level?

final class Stats {
    var count = 0
    func hit() { count += 1 }
}

Submit