AK-21/Graphite-Industrial-Intelligence
0
1/*! *****************************************************************************2Copyright (c) Microsoft Corporation. All rights reserved.3Licensed under the Apache License, Version 2.0 (the "License"); you may not use4this file except in compliance with the License. You may obtain a copy of the5License at http://www.apache.org/licenses/LICENSE-2.06 7THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY8KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED9WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,10MERCHANTABILITY OR NON-INFRINGEMENT.11 12See the Apache Version 2.0 License for specific language governing permissions13and limitations under the License.14***************************************************************************** */15 16 17/// <reference lib="es2015.symbol" />18/// <reference lib="es2015.symbol.wellknown" />19 20interface SharedArrayBuffer {21 /**22 * Read-only. The length of the ArrayBuffer (in bytes).23 */24 readonly byteLength: number;25 26 /**27 * Returns a section of an SharedArrayBuffer.28 */29 slice(begin?: number, end?: number): SharedArrayBuffer;30 readonly [Symbol.toStringTag]: "SharedArrayBuffer";31}32 33interface SharedArrayBufferConstructor {34 readonly prototype: SharedArrayBuffer;35 new (byteLength?: number): SharedArrayBuffer;36 readonly [Symbol.species]: SharedArrayBufferConstructor;37}38declare var SharedArrayBuffer: SharedArrayBufferConstructor;39 40interface ArrayBufferTypes {41 SharedArrayBuffer: SharedArrayBuffer;42}43 44interface Atomics {45 /**46 * Adds a value to the value at the given position in the array, returning the original value.47 * Until this atomic operation completes, any other read or write operation against the array48 * will block.49 */50 add(typedArray: Int8Array<ArrayBufferLike> | Uint8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>, index: number, value: number): number;51 52 /**53 * Stores the bitwise AND of a value with the value at the given position in the array,54 * returning the original value. Until this atomic operation completes, any other read or55 * write operation against the array will block.56 */57 and(typedArray: Int8Array<ArrayBufferLike> | Uint8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>, index: number, value: number): number;58 59 /**60 * Replaces the value at the given position in the array if the original value equals the given61 * expected value, returning the original value. Until this atomic operation completes, any62 * other read or write operation against the array will block.63 */64 compareExchange(typedArray: Int8Array<ArrayBufferLike> | Uint8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>, index: number, expectedValue: number, replacementValue: number): number;65 66 /**67 * Replaces the value at the given position in the array, returning the original value. Until68 * this atomic operation completes, any other read or write operation against the array will69 * block.70 */71 exchange(typedArray: Int8Array<ArrayBufferLike> | Uint8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>, index: number, value: number): number;72 73 /**74 * Returns a value indicating whether high-performance algorithms can use atomic operations75 * (`true`) or must use locks (`false`) for the given number of bytes-per-element of a typed76 * array.77 */78 isLockFree(size: number): boolean;79 80 /**81 * Returns the value at the given position in the array. Until this atomic operation completes,82 * any other read or write operation against the array will block.83 */84 load(typedArray: Int8Array<ArrayBufferLike> | Uint8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>, index: number): number;85 86 /**87 * Stores the bitwise OR of a value with the value at the given position in the array,88 * returning the original value. Until this atomic operation completes, any other read or write89 * operation against the array will block.90 */91 or(typedArray: Int8Array<ArrayBufferLike> | Uint8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>, index: number, value: number): number;92 93 /**94 * Stores a value at the given position in the array, returning the new value. Until this95 * atomic operation completes, any other read or write operation against the array will block.96 */97 store(typedArray: Int8Array<ArrayBufferLike> | Uint8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>, index: number, value: number): number;98 99 /**100 * Subtracts a value from the value at the given position in the array, returning the original101 * value. Until this atomic operation completes, any other read or write operation against the102 * array will block.103 */104 sub(typedArray: Int8Array<ArrayBufferLike> | Uint8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>, index: number, value: number): number;105 106 /**107 * If the value at the given position in the array is equal to the provided value, the current108 * agent is put to sleep causing execution to suspend until the timeout expires (returning109 * `"timed-out"`) or until the agent is awoken (returning `"ok"`); otherwise, returns110 * `"not-equal"`.111 */112 wait(typedArray: Int32Array<ArrayBufferLike>, index: number, value: number, timeout?: number): "ok" | "not-equal" | "timed-out";113 114 /**115 * Wakes up sleeping agents that are waiting on the given index of the array, returning the116 * number of agents that were awoken.117 * @param typedArray A shared Int32Array<ArrayBufferLike>.118 * @param index The position in the typedArray to wake up on.119 * @param count The number of sleeping agents to notify. Defaults to +Infinity.120 */121 notify(typedArray: Int32Array<ArrayBufferLike>, index: number, count?: number): number;122 123 /**124 * Stores the bitwise XOR of a value with the value at the given position in the array,125 * returning the original value. Until this atomic operation completes, any other read or write126 * operation against the array will block.127 */128 xor(typedArray: Int8Array<ArrayBufferLike> | Uint8Array<ArrayBufferLike> | Int16Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike> | Int32Array<ArrayBufferLike> | Uint32Array<ArrayBufferLike>, index: number, value: number): number;129 130 readonly [Symbol.toStringTag]: "Atomics";131}132 133declare var Atomics: Atomics;134 