How can a thread avoid deadlock when acquiring multiple locks?

Last Updated :
Discuss
Comments

How can a thread avoid deadlock when acquiring multiple locks?

By acquiring all locks in the same order consistently

By always using synchronized blocks instead of ReentrantLock

By introducing random delays between lock acquisition

By acquiring a lock only if it is not already held by another thread

Share your thoughts in the comments