Grpc.Core.GrpcEnvironment.ShutdownAsync C# (CSharp) Method

ShutdownAsync() private method

Shuts down this environment.
private ShutdownAsync ( ) : Task
return Task
        private async Task ShutdownAsync()
        {
            if (isClosed)
            {
                throw new InvalidOperationException("Close has already been called");
            }
            await threadPool.StopAsync().ConfigureAwait(false);
            GrpcNativeShutdown();
            isClosed = true;

            debugStats.CheckOK();
        }

Usage Example

Beispiel #1
0
        /// <summary>
        /// Decrements the reference count for currently active environment and asynchronously shuts down the gRPC environment if reference count drops to zero.
        /// </summary>
        internal static async Task ReleaseAsync()
        {
            GrpcEnvironment instanceToShutdown = null;

            lock (staticLock)
            {
                GrpcPreconditions.CheckState(refCount > 0);
                refCount--;
                if (refCount == 0)
                {
                    instanceToShutdown = instance;
                    instance           = null;
                }
            }

            if (instanceToShutdown != null)
            {
                await instanceToShutdown.ShutdownAsync().ConfigureAwait(false);
            }
        }
All Usage Examples Of Grpc.Core.GrpcEnvironment::ShutdownAsync