Skip to content

Commit

Permalink
📌 Use SharedArrayBuffer for Node.js v14.x
Browse files Browse the repository at this point in the history
Signed-off-by: kei-g <km.8k6ce+github@gmail.com>
  • Loading branch information
kei-g committed Aug 23, 2021
1 parent a706fb9 commit 88906ec
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion async-iterable-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,13 @@ export class AsyncIterableQueue<T> implements AsyncIterable<T> {
/**
* この待ち行列の現在の状態
*/
readonly #state = new Uint8Array([AIQState.undefined])
readonly #state = new Uint8Array(new SharedArrayBuffer(1))

/**
* コンストラクタ
*/
constructor() {
this.#state[0] = AIQState.undefined
const resolveAsync = createAsyncResolver({
finish: () => Atomics.exchange(this.#state, 0, AIQState.finished),
resolvers: this.#resolvers,
Expand Down

0 comments on commit 88906ec

Please sign in to comment.