Skip to content

Commit

Permalink
chore: include types in wait-for-others
Browse files Browse the repository at this point in the history
  • Loading branch information
userquin committed May 4, 2024
1 parent 0229a95 commit 4a75567
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/fixtures/wait-for-others.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { threadId } from 'worker_threads'

// @ts-ignore
export default async function ([i32array, n]) {
export default async function ([i32array, n]: [
array: Int32Array,
num: number
]) {
Atomics.add(i32array, 0, 1)
Atomics.notify(i32array, 0, Infinity)
let lastSeenValue
let lastSeenValue: number
while ((lastSeenValue = Atomics.load(i32array, 0)) < n) {
Atomics.wait(i32array, 0, lastSeenValue)
}
Expand Down

0 comments on commit 4a75567

Please sign in to comment.