void () { boolean waiting = false; for (int s;;) { if (((s = lockState) & ~WAITER) == 0) { if (LOCKSTATE.compareAndSet(this, s, WRITER)) { if (waiting) waiter = null; return; } } else if ((s & WAITER) == 0) { if (LOCKSTATE.compareAndSet(this, s, s | WAITER)) { waiting = true; waiter = Thread.currentThread(); } } else if (waiting) LockSupport.park(this); } }