/*! Copyright 2019 Ron Buckton Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. THIRD PARTY LICENSE NOTICE: Barrier is derived from the implementation of Barrier in Promise Extensions for Javascript: https://github.com/rbuckton/prex Promise Extensions is licensed under the Apache 2.0 License: Promise Extensions for JavaScript Copyright (c) Microsoft Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ import { Cancelable } from "@esfx/cancelable"; /** * Enables multiple tasks to cooperatively work on an algorithm through * multiple phases. */ export declare class AsyncBarrier { private _isExecutingPostPhaseAction; private _postPhaseAction; private _phaseNumber; private _participantCount; private _remainingParticipants; private _waiters; /** * Initializes a new instance of the Barrier class. * * @param participantCount The initial number of participants for the barrier. * @param postPhaseAction An action to execute between each phase. */ constructor(participantCount: number, postPhaseAction?: (barrier: AsyncBarrier) => void | PromiseLike); /** * Gets the number of the Barrier's current phase. */ get currentPhaseNumber(): number; /** * Gets the total number of participants in the barrier. */ get participantCount(): number; /** * Gets the number of participants in the barrier that haven't yet signaled in the current phase. */ get remainingParticipants(): number; /** * Notifies the Barrier there will be additional participants. * * @param participantCount The number of additional participants. */ add(participantCount?: number): void; /** * Notifies the Barrier there will be fewer participants. * * @param participantCount The number of participants to remove. */ remove(participantCount?: number): void; /** * Signals that a participant has reached the barrier and waits for all other participants * to reach the barrier. * * @param cancelable An optional Cancelable used to cancel the request. */ signalAndWait(cancelable?: Cancelable): Promise; private _finishPhase; private _nextPhase; private _resolveNextPhase; private _rejectNextPhase; } //# sourceMappingURL=index.d.ts.map