The documentation immediately says after that:
So, it is possible for one thread to invoke acquire before another, but reach the ordering point after the other
Which means this scenario is possible:
thread 1 thread 2
-------- --------
calls acquire()
calls acquire()
acquire() does its job
acquire() does its job
(where acquires() does its job
is what the doc refers to as the "ordering point")
In short: there is no guarantee that, timely speaking, the first thread calling acquire()
gets to acquire the semaphore first. What is guaranteed is that when it returns from acquire()
, other acquire()
callers will have to wait.
This is a rare occurrence, but possible.