useBlocking(true); $lock->setName('foo'); if ($lock->acquire()) { echo "got lock!"; sleep(10); echo " bye\n"; exit(0); } echo "no luck!\n"; exit(1);