mirror of
https://github.com/nodejs/node.git
synced 2025-05-08 09:07:45 +00:00

We currently mark a number of `ArrayBuffer`s as not transferable, including the `Buffer` pool and ones with finalizers provided by C++ addons. There is no good reason to assume that userland code might not encounter similar problems, for example when doing `ArrayBuffer` pooling similar to ours. Therefore, provide an API that lets userland code also mark objects as not transferable. PR-URL: https://github.com/nodejs/node/pull/33979 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
36 lines
558 B
JavaScript
36 lines
558 B
JavaScript
'use strict';
|
|
|
|
const {
|
|
isMainThread,
|
|
SHARE_ENV,
|
|
resourceLimits,
|
|
threadId,
|
|
Worker
|
|
} = require('internal/worker');
|
|
|
|
const {
|
|
MessagePort,
|
|
MessageChannel,
|
|
moveMessagePortToContext,
|
|
receiveMessageOnPort,
|
|
} = require('internal/worker/io');
|
|
|
|
const {
|
|
markAsUntransferable,
|
|
} = require('internal/buffer');
|
|
|
|
module.exports = {
|
|
isMainThread,
|
|
MessagePort,
|
|
MessageChannel,
|
|
markAsUntransferable,
|
|
moveMessagePortToContext,
|
|
receiveMessageOnPort,
|
|
resourceLimits,
|
|
threadId,
|
|
SHARE_ENV,
|
|
Worker,
|
|
parentPort: null,
|
|
workerData: null,
|
|
};
|