Exemple #1
0
        public override async Task Dispose()
        {
            using (trace.NewFrame)
            {
                if (IsDisposed)
                {
                    trace.Warning("Already disposed");
                    return;
                }

                if (listeningThread != null)
                {
                    if (!listeningThread.IsAlive)
                    {
                        trace.Info("Thread is not alive.");
                    }
                    else
                    {
                        trace.Info("Thread has been created. Setting stop event and joining the thread.");
                        stopEvt.Cancel();
                        listeningThread.Join();
                        trace.Info("Thread finished");
                    }
                }

                if (output != null)
                {
                    output.Dispose();
                }

                trace.Info("Calling base destructor");
                await base.Dispose();
            }
        }