Core concept

synchronized void inc() { count++; }
synchronized (obj) { /* critical */ }
Advertisement

How it works

Cannot interrupt. Not timeout-able. Pin virtual threads.

Advertisement

Trade-offs + gotchas

Simple cases. Legacy code.