Java: Atomic integer example
After my post 'ThreadLocal, what is it?' I would write some words about the java.util.concurrent.atomic package that contains a small toolkit of classes supporting lock-free thread-safe programming on single variables. We will compare in this example the 3 types of shared counters: - a simple counter without synchronization or lock, - an advanced counter with synchronization, - an atomic counter without synchronization or lock ...more»