Skip to content

Commit

Permalink
fix: wasi threads max tid should be 0x1FFFFFFF
Browse files Browse the repository at this point in the history
  • Loading branch information
toyobayashi committed Oct 21, 2023
1 parent b98c581 commit 0de0e5c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/emnapi/src/core/async.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ function spawnThread (startArg: number, errorOrTid: number): number {
Atomics.store(struct, 1, tid)
Atomics.notify(struct, 1)

PThread.nextWorkerID = (PThread.nextWorkerID + 1) % (0xffffffff - 42)
const WASI_THREADS_MAX_TID = 0x1FFFFFFF
PThread.nextWorkerID = (PThread.nextWorkerID + 1) % (WASI_THREADS_MAX_TID - 42)
PThread.pthreads[tid] = worker
worker.__emnapi_tid = tid
PThread.runningWorkers.push(worker)
Expand Down

0 comments on commit 0de0e5c

Please sign in to comment.