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="es2020.bigint" />18 19interface Atomics {20 /**21 * Adds a value to the value at the given position in the array, returning the original value.22 * Until this atomic operation completes, any other read or write operation against the array23 * will block.24 */25 add(typedArray: BigInt64Array<ArrayBufferLike> | BigUint64Array<ArrayBufferLike>, index: number, value: bigint): bigint;26 27 /**28 * Stores the bitwise AND of a value with the value at the given position in the array,29 * returning the original value. Until this atomic operation completes, any other read or30 * write operation against the array will block.31 */32 and(typedArray: BigInt64Array<ArrayBufferLike> | BigUint64Array<ArrayBufferLike>, index: number, value: bigint): bigint;33 34 /**35 * Replaces the value at the given position in the array if the original value equals the given36 * expected value, returning the original value. Until this atomic operation completes, any37 * other read or write operation against the array will block.38 */39 compareExchange(typedArray: BigInt64Array<ArrayBufferLike> | BigUint64Array<ArrayBufferLike>, index: number, expectedValue: bigint, replacementValue: bigint): bigint;40 41 /**42 * Replaces the value at the given position in the array, returning the original value. Until43 * this atomic operation completes, any other read or write operation against the array will44 * block.45 */46 exchange(typedArray: BigInt64Array<ArrayBufferLike> | BigUint64Array<ArrayBufferLike>, index: number, value: bigint): bigint;47 48 /**49 * Returns the value at the given position in the array. Until this atomic operation completes,50 * any other read or write operation against the array will block.51 */52 load(typedArray: BigInt64Array<ArrayBufferLike> | BigUint64Array<ArrayBufferLike>, index: number): bigint;53 54 /**55 * Stores the bitwise OR of a value with the value at the given position in the array,56 * returning the original value. Until this atomic operation completes, any other read or write57 * operation against the array will block.58 */59 or(typedArray: BigInt64Array<ArrayBufferLike> | BigUint64Array<ArrayBufferLike>, index: number, value: bigint): bigint;60 61 /**62 * Stores a value at the given position in the array, returning the new value. Until this63 * atomic operation completes, any other read or write operation against the array will block.64 */65 store(typedArray: BigInt64Array<ArrayBufferLike> | BigUint64Array<ArrayBufferLike>, index: number, value: bigint): bigint;66 67 /**68 * Subtracts a value from the value at the given position in the array, returning the original69 * value. Until this atomic operation completes, any other read or write operation against the70 * array will block.71 */72 sub(typedArray: BigInt64Array<ArrayBufferLike> | BigUint64Array<ArrayBufferLike>, index: number, value: bigint): bigint;73 74 /**75 * If the value at the given position in the array is equal to the provided value, the current76 * agent is put to sleep causing execution to suspend until the timeout expires (returning77 * `"timed-out"`) or until the agent is awoken (returning `"ok"`); otherwise, returns78 * `"not-equal"`.79 */80 wait(typedArray: BigInt64Array<ArrayBufferLike>, index: number, value: bigint, timeout?: number): "ok" | "not-equal" | "timed-out";81 82 /**83 * Wakes up sleeping agents that are waiting on the given index of the array, returning the84 * number of agents that were awoken.85 * @param typedArray A shared BigInt64Array.86 * @param index The position in the typedArray to wake up on.87 * @param count The number of sleeping agents to notify. Defaults to +Infinity.88 */89 notify(typedArray: BigInt64Array<ArrayBufferLike>, index: number, count?: number): number;90 91 /**92 * Stores the bitwise XOR of a value with the value at the given position in the array,93 * returning the original value. Until this atomic operation completes, any other read or write94 * operation against the array will block.95 */96 xor(typedArray: BigInt64Array<ArrayBufferLike> | BigUint64Array<ArrayBufferLike>, index: number, value: bigint): bigint;97}98 