Locking strategies and techniques for preventing deadlocks in code

后端 未结 5 1116
执笔经年
执笔经年 2020-12-04 10:14

The common solution to preventing deadlock in code is to make sure the sequence of locking occur in a common manner regardless of which thread is accessing the resources.

5条回答
  •  北海茫月
    2020-12-04 10:35

    While not an alternative to the known-sequence solution you mention, Andrei Alexandrescu wrote about some techniques for compile time checks that acquisition of locks is done through the intended mechanisms. See http://www.informit.com/articles/article.aspx?p=25298

提交回复
热议问题