Esempio n. 1
0
        private WaitHandle StartHost(IHostController host, IStartupArguments args)
        {
            var handle = new ManualResetEvent(false);
            new Thread(() =>
            {
                try
                {
                    host.Initialize();
                    host.Start(args);
                }
                catch (Exception ex)
                {
                    log.Error(string.Format("Failed to start '{0}'", host.Name), ex);
                }
                finally
                {
                    try
                    {
                        handle.Set();
                    }
                    catch (Exception ex)
                    {
                        log.Error("Failed to set handle signalling host started.", ex);
                    }
                }
            })
            {
                IsBackground = true
            }.Start();

            return handle;
        }