Exemplo n.º 1
0
        public async Task DisposeAsync()
        {
            // Ensure the event loop is still running.
            // If the event loop isn't running and we try to wait on this Post
            // to complete, then LibuvTransport will never be disposed and
            // the exception that stopped the event loop will never be surfaced.
            if (_thread.FatalError == null)
            {
                await _thread.PostAsync(listener =>
                {
                    listener.DispatchPipe.Dispose();
                    listener.FreeBuffer();

                    listener._closed = true;
                }, this).ConfigureAwait(false);
            }
            else
            {
                FreeBuffer();
            }
        }