//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//------------------------------------------------------------------------------
namespace System.Web.Util {
using System;
using System.Threading;
using System.Threading.Tasks;
// This class is similar to CountdownEvent, but it uses Task under the covers
// instead of ManualResetEvent. When the internal counter hits zero, the Task
// is marked as complete.
//
// This type is thread-safe. Error checking is not performed in RET builds.
internal sealed class CountdownTask {
private int _pendingCount;
private readonly TaskCompletionSource