Even if the increment were atomic (it isn't), the code would still not be threadsafe unless you made the variable volatile. Without this, you might run into problems with memory barriers and out-of-order execution. See the JLS for more details.
A final point. Synchronization is not expensive. Please don't even consider avoiding it until (a) you have shown using a profiler that it incurs significant performance or concurrency penalties, (b) these penalties are caused by the synchronization mechanism itself and not by improper use of it and (c) you know exactly what you're doing. Otherwise, don't go there. Here be dragons.
- Peter [ August 14, 2004: Message edited by: Peter den Haan ]