private static function startListening($socketAddress)
    {
        $lock = Lock::acquire();
        if (self::$killSwitchPath !== null) {
            $kswitch = new KillSwitch(self::$killSwitchPath);
            if ($kswitch->getGlobal() || $kswitch->hasAddress($socketAddress)) {
                throw new Exception\RuntimeException('This worker has been prevented from starting using the kill switch');
            }
        }
        $socketFile = IdentificationHelper::getSocketFile($socketAddress);
        if ($socketFile !== null) {
            $socketDir = dirname($socketFile);
            if (!is_dir($socketDir)) {
                mkdir($socketDir, 0777, true);
            }
        }
        $server = SocketFactory::createServerSocket($socketAddress, self::$socketContext);
        $lock->release();
        self::$socket = $server;
        self::$listening = true;
        self::$toDelete = $socketFile;

        return $server;
    }
private static function startListening($socketAddress)
    {
        $lock = Lock::acquire();
        if (self::$killSwitchPath !== null) {
            $kswitch = new KillSwitch(self::$killSwitchPath);
            if ($kswitch->getGlobal() || $kswitch->hasAddress($socketAddress)) {
                throw new Exception\RuntimeException('This worker has been prevented from starting using the kill switch');
            }
        }
        $socketFile = IdentificationHelper::getSocketFile($socketAddress);
        if ($socketFile !== null) {
            $socketDir = dirname($socketFile);
            if (!is_dir($socketDir)) {
                mkdir($socketDir, 0777, true);
            }
        }
        $server = SocketFactory::createServerSocket($socketAddress, self::$socketContext);
        $lock->release();
        self::$socket = $server;
        self::$listening = true;
        self::$toDelete = $socketFile;

        return $server;
    }
@param string $socketAddress

@throws Exception\BindOrListenException
@throws Exception\RuntimeException

@return resource