1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | import { CancellationToken } from "./cancellation";
|
8 | import { Cancelable } from "@esfx/cancelable";
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | export declare class Semaphore {
|
14 | private _maxCount;
|
15 | private _currentCount;
|
16 | private _waiters;
|
17 | |
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 | constructor(initialCount: number, maxCount?: number);
|
24 | /**
|
25 | * Gets the number of remaining asynchronous operations that can enter
|
26 | * the Semaphore.
|
27 | */
|
28 | get count(): number;
|
29 | /**
|
30 | * Asynchronously waits for the event to become signaled.
|
31 | *
|
32 | * @param token A CancellationToken used to cancel the request.
|
33 | */
|
34 | wait(token?: CancellationToken | Cancelable): Promise<void>;
|
35 | /**
|
36 | * Releases the Semaphore one or more times.
|
37 | *
|
38 | * @param count The number of times to release the Semaphore.
|
39 | */
|
40 | release(count?: number): void;
|
41 | }
|