1
0
mirror of https://github.com/Snailclimb/JavaGuide synced 2025-06-20 22:17:09 +08:00

Merge pull request #430 from 0ffff/master

修改避免死锁为预防死锁
This commit is contained in:
SnailClimb 2019-08-18 17:58:12 +08:00 committed by GitHub
commit 5e10891a2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -340,7 +340,7 @@ Thread[线程 2,5,main]waiting get resource1
1. 不剥夺条件:线程已获得的资源在末使用完之前不能被其他线程强行剥夺,只有自己使用完毕后才释放资源。 1. 不剥夺条件:线程已获得的资源在末使用完之前不能被其他线程强行剥夺,只有自己使用完毕后才释放资源。
1. 循环等待条件:若干进程之间形成一种头尾相接的循环等待资源关系。 1. 循环等待条件:若干进程之间形成一种头尾相接的循环等待资源关系。
### 如何避免线程死锁? ### 如何预防线程死锁?
我们只要破坏产生死锁的四个条件中的其中一个就可以了。 我们只要破坏产生死锁的四个条件中的其中一个就可以了。