When using multiple threads, a very simple way to avoid deadlock is: Specifies the order of acquisition of the lock, and forcibly acquiring a lock thread in the specified order. If all the threads are in the same order and the release added, there would not be dead.
JAVA --- how to ensure N N threads can access resources while not leading to a deadlock?
Guess you like
Origin www.cnblogs.com/H-hy/p/11240058.html
Ranking