Skip to main content

2022-07-25

Work Research

Preparing Data Transmission

  • Inside Worker Thread MutationTransfer.ts, create a transferSync layer.
  • Add a key TransferrableKeys.synchronous.

Transmitting Data

Whenever we need a synchronous operation,

  • Allocate a SharedArrayBuffer inside transferSync.
  • Run Atomic.wait() at the main thread.
  • Run the calculation at the corresponding processor on the main thread.
  • Pass the data into the received SharedArrayBuffer.
  • Unfreeze the worker thread with Atomic.notify().