This re-introduces the fast path implementation, but only if Builder::fair is set to false.
The fast path is implemented as a spinning compare exchange over the existing token balance. So if tokens happen to be visible during an acquire, a task can try to acquire it immediately.
This however fails if the state cannot be restored, and the task then falls over to the slower locking path.
This re-introduces the fast path implementation, but only if
Builder::fair
is set tofalse
.The fast path is implemented as a spinning compare exchange over the existing token balance. So if tokens happen to be visible during an acquire, a task can try to acquire it immediately.
This however fails if the state cannot be restored, and the task then falls over to the slower locking path.