1 /*! *****************************************************************************
2 Copyright (c) Microsoft Corporation. All rights reserved.
3 Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4 this file except in compliance with the License. You may obtain a copy of the
5 License at http://www.apache.org/licenses/LICENSE-2.0
7 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8 KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9 WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10 MERCHANTABLITY OR NON-INFRINGEMENT.
12 See the Apache Version 2.0 License for specific language governing permissions
13 and limitations under the License.
14 ***************************************************************************** */
18 /// <reference no-default-lib="true"/>
\r
21 /// <reference lib="es2015.symbol" />
\r
22 /// <reference lib="es2015.symbol.wellknown" />
\r
24 interface SharedArrayBuffer {
\r
26 * Read-only. The length of the ArrayBuffer (in bytes).
\r
28 readonly byteLength: number;
\r
31 * The SharedArrayBuffer constructor's length property whose value is 1.
\r
35 * Returns a section of an SharedArrayBuffer.
\r
37 slice(begin: number, end?: number): SharedArrayBuffer;
\r
38 readonly [Symbol.species]: SharedArrayBuffer;
\r
39 readonly [Symbol.toStringTag]: "SharedArrayBuffer";
\r
42 interface SharedArrayBufferConstructor {
\r
43 readonly prototype: SharedArrayBuffer;
\r
44 new (byteLength: number): SharedArrayBuffer;
\r
46 declare var SharedArrayBuffer: SharedArrayBufferConstructor;
\r
48 interface ArrayBufferTypes {
\r
49 SharedArrayBuffer: SharedArrayBuffer;
\r
54 * Adds a value to the value at the given position in the array, returning the original value.
\r
55 * Until this atomic operation completes, any other read or write operation against the array
\r
58 add(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
\r
61 * Stores the bitwise AND of a value with the value at the given position in the array,
\r
62 * returning the original value. Until this atomic operation completes, any other read or
\r
63 * write operation against the array will block.
\r
65 and(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
\r
68 * Replaces the value at the given position in the array if the original value equals the given
\r
69 * expected value, returning the original value. Until this atomic operation completes, any
\r
70 * other read or write operation against the array will block.
\r
72 compareExchange(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, expectedValue: number, replacementValue: number): number;
\r
75 * Replaces the value at the given position in the array, returning the original value. Until
\r
76 * this atomic operation completes, any other read or write operation against the array will
\r
79 exchange(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
\r
82 * Returns a value indicating whether high-performance algorithms can use atomic operations
\r
83 * (`true`) or must use locks (`false`) for the given number of bytes-per-element of a typed
\r
86 isLockFree(size: number): boolean;
\r
89 * Returns the value at the given position in the array. Until this atomic operation completes,
\r
90 * any other read or write operation against the array will block.
\r
92 load(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number): number;
\r
95 * Stores the bitwise OR of a value with the value at the given position in the array,
\r
96 * returning the original value. Until this atomic operation completes, any other read or write
\r
97 * operation against the array will block.
\r
99 or(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
\r
102 * Stores a value at the given position in the array, returning the new value. Until this
\r
103 * atomic operation completes, any other read or write operation against the array will block.
\r
105 store(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
\r
108 * Subtracts a value from the value at the given position in the array, returning the original
\r
109 * value. Until this atomic operation completes, any other read or write operation against the
\r
110 * array will block.
\r
112 sub(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
\r
115 * If the value at the given position in the array is equal to the provided value, the current
\r
116 * agent is put to sleep causing execution to suspend until the timeout expires (returning
\r
117 * `"timed-out"`) or until the agent is awoken (returning `"ok"`); otherwise, returns
\r
120 wait(typedArray: Int32Array, index: number, value: number, timeout?: number): "ok" | "not-equal" | "timed-out";
\r
123 * Wakes up sleeping agents that are waiting on the given index of the array, returning the
\r
124 * number of agents that were awoken.
\r
126 notify(typedArray: Int32Array, index: number, count: number): number;
\r
129 * Stores the bitwise XOR of a value with the value at the given position in the array,
\r
130 * returning the original value. Until this atomic operation completes, any other read or write
\r
131 * operation against the array will block.
\r
133 xor(typedArray: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, index: number, value: number): number;
\r
135 readonly [Symbol.toStringTag]: "Atomics";
\r
138 declare var Atomics: Atomics;
\r