Exemple #1
0
        private async Task StartHostAsyncBackground(RHostStartupInfo startupInfo, IRSessionCallback callback, IBinaryAsyncLockToken lockToken, int timeout)
        {
            await TaskUtilities.SwitchToBackgroundThread();

            _callback    = callback;
            _startupInfo = startupInfo;
            RHost host;

            try {
                host = await BrokerClient.ConnectAsync(startupInfo.Name, this, startupInfo.RHostCommandLineArguments, timeout);
            } catch (OperationCanceledException ex) {
                _initializationTcs.TrySetCanceled(ex);
                lockToken.Reset();
                throw;
            } catch (Exception ex) {
                _initializationTcs.TrySetException(ex);
                lockToken.Reset();
                throw;
            }

            await StartHostAsyncBackground(host, lockToken);
        }