Release releases the connection back to the pool. This is an optimized inline method for the hot path (Put operation). It tries to transition from IN_USE -> IDLE. Returns true if the connection was successfully released, false otherwise. Performance: This is faster than calling GetStateMachine() +
()
| 826 | // If the state machine ever needs to notify waiters |
| 827 | // on this transition, update this to use TryTransitionFast(). |
| 828 | func (cn *Conn) Release() bool { |
| 829 | // Inline the hot path - single CAS operation |
| 830 | return cn.stateMachine.state.CompareAndSwap(uint32(StateInUse), uint32(StateIdle)) |
| 831 | } |
| 832 | |
| 833 | // ClearHandoffState clears the handoff state after successful handoff. |
| 834 | // Makes the connection usable again. |