Add test for thread waiting for lock