%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home2/rezakur1/api.rezakurnia.com/zh-router/node_modules/thread-stream/test/
Upload File :
Create Path :
Current File : //home2/rezakur1/api.rezakurnia.com/zh-router/node_modules/thread-stream/test/ready-race-worker.js

'use strict'

const { parentPort, workerData } = require('node:worker_threads')
const { WRITE_INDEX, READ_INDEX } = require('../lib/indexes')

const state = new Int32Array(workerData.stateBuf)

parentPort.on('message', (msg) => {
  if (msg?.code === 'ADVANCE') {
    const end = Atomics.load(state, WRITE_INDEX)
    Atomics.store(state, READ_INDEX, end)
    Atomics.notify(state, READ_INDEX)
  } else if (msg?.code === 'SHUTDOWN') {
    process.exit(0)
  }
})

parentPort.postMessage({ code: 'READY' })
parentPort.postMessage({
  code: 'EVENT',
  name: 'write-more'
})

Zerion Mini Shell 1.0