if you want to unlock in FIFO order, you can use custom lock. There is a FIFO lock in ACE; it is called ACE_Token, and since it is open source, perhaps you can use it as a reference implementation. I think that the overhead of using it will be minimal.
source share