Locks
What synchronized guarantees, on which object, and what it still does not protect.
synchronized is one keyword doing two jobs, and almost everyone knows about the first. The second — that leaving a lock publishes everything you wrote inside it — is what makes locking a correctness tool rather than a queueing one. It also covers what a lock cannot protect, which is more than you would expect.
Contents
9 cardsnot started