[6a3a178] | 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
|
---|
| 6 |
|
---|
| 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.
|
---|
| 11 |
|
---|
| 12 | See the Apache Version 2.0 License for specific language governing permissions
|
---|
| 13 | and limitations under the License.
|
---|
| 14 | ***************************************************************************** */
|
---|
| 15 |
|
---|
| 16 |
|
---|
| 17 |
|
---|
| 18 | /// <reference no-default-lib="true"/>
|
---|
| 19 |
|
---|
| 20 |
|
---|
| 21 | interface Atomics {
|
---|
| 22 | /**
|
---|
| 23 | * Adds a value to the value at the given position in the array, returning the original value.
|
---|
| 24 | * Until this atomic operation completes, any other read or write operation against the array
|
---|
| 25 | * will block.
|
---|
| 26 | */
|
---|
| 27 | add(typedArray: BigInt64Array | BigUint64Array, index: number, value: bigint): bigint;
|
---|
| 28 |
|
---|
| 29 | /**
|
---|
| 30 | * Stores the bitwise AND of a value with the value at the given position in the array,
|
---|
| 31 | * returning the original value. Until this atomic operation completes, any other read or
|
---|
| 32 | * write operation against the array will block.
|
---|
| 33 | */
|
---|
| 34 | and(typedArray: BigInt64Array | BigUint64Array, index: number, value: bigint): bigint;
|
---|
| 35 |
|
---|
| 36 | /**
|
---|
| 37 | * Replaces the value at the given position in the array if the original value equals the given
|
---|
| 38 | * expected value, returning the original value. Until this atomic operation completes, any
|
---|
| 39 | * other read or write operation against the array will block.
|
---|
| 40 | */
|
---|
| 41 | compareExchange(typedArray: BigInt64Array | BigUint64Array, index: number, expectedValue: bigint, replacementValue: bigint): bigint;
|
---|
| 42 |
|
---|
| 43 | /**
|
---|
| 44 | * Replaces the value at the given position in the array, returning the original value. Until
|
---|
| 45 | * this atomic operation completes, any other read or write operation against the array will
|
---|
| 46 | * block.
|
---|
| 47 | */
|
---|
| 48 | exchange(typedArray: BigInt64Array | BigUint64Array, index: number, value: bigint): bigint;
|
---|
| 49 |
|
---|
| 50 | /**
|
---|
| 51 | * Returns the value at the given position in the array. Until this atomic operation completes,
|
---|
| 52 | * any other read or write operation against the array will block.
|
---|
| 53 | */
|
---|
| 54 | load(typedArray: BigInt64Array | BigUint64Array, index: number): bigint;
|
---|
| 55 |
|
---|
| 56 | /**
|
---|
| 57 | * Stores the bitwise OR of a value with the value at the given position in the array,
|
---|
| 58 | * returning the original value. Until this atomic operation completes, any other read or write
|
---|
| 59 | * operation against the array will block.
|
---|
| 60 | */
|
---|
| 61 | or(typedArray: BigInt64Array | BigUint64Array, index: number, value: bigint): bigint;
|
---|
| 62 |
|
---|
| 63 | /**
|
---|
| 64 | * Stores a value at the given position in the array, returning the new value. Until this
|
---|
| 65 | * atomic operation completes, any other read or write operation against the array will block.
|
---|
| 66 | */
|
---|
| 67 | store(typedArray: BigInt64Array | BigUint64Array, index: number, value: bigint): bigint;
|
---|
| 68 |
|
---|
| 69 | /**
|
---|
| 70 | * Subtracts a value from the value at the given position in the array, returning the original
|
---|
| 71 | * value. Until this atomic operation completes, any other read or write operation against the
|
---|
| 72 | * array will block.
|
---|
| 73 | */
|
---|
| 74 | sub(typedArray: BigInt64Array | BigUint64Array, index: number, value: bigint): bigint;
|
---|
| 75 |
|
---|
| 76 | /**
|
---|
| 77 | * If the value at the given position in the array is equal to the provided value, the current
|
---|
| 78 | * agent is put to sleep causing execution to suspend until the timeout expires (returning
|
---|
| 79 | * `"timed-out"`) or until the agent is awoken (returning `"ok"`); otherwise, returns
|
---|
| 80 | * `"not-equal"`.
|
---|
| 81 | */
|
---|
| 82 | wait(typedArray: BigInt64Array, index: number, value: bigint, timeout?: number): "ok" | "not-equal" | "timed-out";
|
---|
| 83 |
|
---|
| 84 | /**
|
---|
| 85 | * Wakes up sleeping agents that are waiting on the given index of the array, returning the
|
---|
| 86 | * number of agents that were awoken.
|
---|
| 87 | * @param typedArray A shared BigInt64Array.
|
---|
| 88 | * @param index The position in the typedArray to wake up on.
|
---|
| 89 | * @param count The number of sleeping agents to notify. Defaults to +Infinity.
|
---|
| 90 | */
|
---|
| 91 | notify(typedArray: BigInt64Array, index: number, count?: number): number;
|
---|
| 92 |
|
---|
| 93 | /**
|
---|
| 94 | * Stores the bitwise XOR of a value with the value at the given position in the array,
|
---|
| 95 | * returning the original value. Until this atomic operation completes, any other read or write
|
---|
| 96 | * operation against the array will block.
|
---|
| 97 | */
|
---|
| 98 | xor(typedArray: BigInt64Array | BigUint64Array, index: number, value: bigint): bigint;
|
---|
| 99 | }
|
---|