News for hackers. Stuff that matters.
Re:Use lock addresses to enforce uniform locking order. Avoi... by sesquipedalian on Sunday June 14, 2015 @02:48PM (#9715910)
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!
Re:Use lock addresses to enforce uniform locking order. Avoi... by Sharlin on Monday June 15, 2015 @07:18AM (#9718641)
Interestingly, 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.