On Thursday, 16 July 2015 at 21:48:06 UTC, byron wrote:
On Thursday, 16 July 2015 at 07:57:13 UTC, aki wrote:[...]If I remember a synchronized method requires "this" to be shared, you should be fine using a synchronized block in the method for non-shared instances. But using atomicOp will avoid a lock.void inc() { synchronized { ++count; } } You are locking on this object instance by default
Also this is from Andrie's book http://www.informit.com/articles/article.aspx?p=1609144