Re:Use lock addresses to enforce uniform locking order. Avoi...
by amelius on Sunday June 14, 2015 @12:26PM
(#9715436)
Sorry, but this is a too simplistic view of the problem. In reality, libraries perform locks, then invoke callback functions, which might perform other locks. Hence, you cannot always control the order of the locking without refactoring your code and messing up modularity.
Re:Use lock addresses to enforce uniform locking order. Avoi...
by lukesandberg on Sunday June 14, 2015 @02:40PM
(#9715883)
Which is why the maxim "don't hold locks while calling untrusted code" exists. Holding a lock while invoking a callback is extremely dangerous. Some situations demnd doing this (but not that often), in which case you need to document it like crazy.
Indeed, this extends quite naturally to locks that are not related from modules that are not aware of each other.
I repeat, just brilliant.