MCPcopy Index your code
hub / github.com/nodejs/node / receiveMessageFromWorker

Function receiveMessageFromWorker

lib/internal/worker/messaging.js:130–146  ·  view source on GitHub ↗
(source, value, memory)

Source from the content-addressed store, hash-verified

128}
129
130function receiveMessageFromWorker(source, value, memory) {
131 let response = WORKER_MESSAGING_RESULT_NO_LISTENERS;
132
133 try {
134 if (process.emit('workerMessage', value, source)) {
135 response = WORKER_MESSAGING_RESULT_DELIVERED;
136 }
137 } catch {
138 response = WORKER_MESSAGING_RESULT_LISTENER_ERROR;
139 }
140
141 // Populate the result
142 const status = new Int32Array(memory);
143 AtomicsStore(status, WORKER_MESSAGING_RESULT_INDEX, response);
144 AtomicsStore(status, WORKER_MESSAGING_STATUS_INDEX, 1);
145 AtomicsNotify(status, WORKER_MESSAGING_STATUS_INDEX, 1);
146}
147
148function createMainThreadPort(threadId) {
149 // Create a channel that links the new thread to the main thread

Callers 2

sendMessageToWorkerFunction · 0.85

Calls 1

emitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…