Is the pre-increment operator thread-safe?

No, you should be using something like java.util.concurrent.atomic.AtomicInteger. Look at its getAndIncrement() method.

Leave a Comment