This avoids creaing a semaphore where it is not needed, especially as most of these locks are never used from another thread (in the reports in #16246, there are thousands of semaphores from this with only a small handful having a "last acquirer" != 0.)