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