Locking one thread until the contended resources are available