K
Knute Johnson
Thomas said:But increment has a read and a separate write. Read the value.
Increment. Write the new value.
Best to use java.util.concurrent.AtomicLong (from 1.5) for these sort of
things.
http://download.java.net/jdk6/docs/api/java/util/concurrent/atomic/AtomicLong.html#incrementAndGet()
Tom Hawtin
Tom:
Yes, I see what you are saying. I'll rerun those tests with it
synchronized and see what happens. If they were in fact passing between
the read and write then the results would show lower performance for
more threads.