5 ms·
This is one of those things that seems obvious in hindsight. However, it never occurred to me that one could simply use the lock address to impose a consistent
by sesquipedalian 11y ago
This is one of those things that seems obvious in hindsight. However, it never occurred to me that one could simply use the lock address to impose a consistent and unique ordering on the locks rather than some other explicit mechanism. It's a rather clever solution, the pointer is the sequence number!
- Sharlin 11y agoInterestingly, in C and C++ the ordering of two pointers not pointing to the same array is not well-defined because the address space may not be flat. In C++ the standard function object std::less is specifically guaranteed to impose a total order on pointers even thought the builtin less-than operator does not.