I thought the --
and ++
operations are not atomic, i.e. two threads doing ++
could both read 2 and write back 3 - but the correct value should be 4.
Type your question above this line.
Course: https://www.educative.io/collection/5307417243942912/6345276711239680
Lesson: https://www.educative.io/collection/page/5307417243942912/6345276711239680/6650923076026368