From 5623814dec538bd86a239a47135ad1262574bac6 Mon Sep 17 00:00:00 2001 From: theanarkh Date: Fri, 9 Dec 2022 21:33:10 +0800 Subject: [PATCH] doc: add tip for NODE_MODULE --- doc/api/addons.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/api/addons.md b/doc/api/addons.md index 2800c55254cfd0..46acacc7531574 100644 --- a/doc/api/addons.md +++ b/doc/api/addons.md @@ -107,6 +107,14 @@ When building addons with `node-gyp`, using the macro `NODE_GYP_MODULE_NAME` as the first parameter of `NODE_MODULE()` will ensure that the name of the final binary will be passed to `NODE_MODULE()`. +If you define addon with `NODE_MODULE`, The usage is as follows. + +1. If you load the addon in main thread first, you can not load the addon + in worker. +2. If you load the addon in worker first, you can not load the addon in + main thread, and you can only load the addon in another worker after the + worker which have loaded the addon exsits. + ### Context-aware addons There are environments in which Node.js addons may need to be loaded multiple