What happens if two threads try to acquire the same lock using ReentrantLock simultaneously?

Last Updated :
Discuss
Comments

What happens if two threads try to acquire the same lock using ReentrantLock simultaneously?

Both threads are allowed to acquire the lock at the same time

One thread will acquire the lock, and the other will block until the lock is released

Both threads will immediately terminate

The lock will be automatically split between the two threads

Share your thoughts in the comments