lib.es2020.sharedmemory.d.ts 4.7 KB

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