$lock = new swoole_lock(SWOOLE_MUTEX);
echo "[主进程]创建锁\n";
$lock->lock();
if (pcntl_fork() > 0){
sleep(1);
$lock->unlock();
}else{
echo "[子进程]等待锁\n";
$lock->lock();
echo "[子进程]获取锁\n";
$lock->unlock();
exit("[子进程]退出\n");
}
echo "[主进程]释放锁\n";
unset($lock);
sleep(1);
echo "[主进程]退出\n";