How to avoid deadlocks?

前端 未结 8 1019
隐瞒了意图╮
隐瞒了意图╮ 2021-02-01 03:30

When using multiple threads, shared memory needs to be locked by critical sections. However, using critical sections causes potential deadlocks. How can they be avoided?

8条回答
  •  南笙
    南笙 (楼主)
    2021-02-01 03:44

    The Related list to the right on this page contains a few links that provides interesting information on the topic.

    In addition to that list, there are many other SO questions discussing the topic, such as

    • Threading Best Practices
    • Why is lock(this) {…} bad?
    • What are common reasons for deadlocks?

    ...and many more

提交回复
热议问题