-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Require for native add-ons in worker_threads #34
Comments
After resolving this problem we can use solution here: metarhia/impress#1099 |
worker_threads doesn't support native addons as of 11.9.0 Edit: after additional testing, it looks like you can safely run the above code on node 11.7.0+ |
It works in 11.9.0 if you require from a single worker, but fails if you require from master process and 1 worker or from more then 1 workers. We need at least: mdsf, websocket, argon2 |
Refs: nodejs/node#26175 |
Refs: nodejs/node#23319 |
Starting from Node.js 11.11.0 (nodejs/node#26175) it should be possible to use native addons from multiple worker threads as long as they are
(https://nodejs.org/api/addons.html#addons_worker_support) Where the latter basically means that the addon properly manages its global/static state to protect it against race conditions, clean up its data when instance shutdowns, doesn't store persistent JS object references and doesn't access JS objects from the wrong context (not the one they were created in). Therefore using |
Some modules, for example
argon2
can't be loaded in worker threads.Try
load.js
with the following code:and
thread.js
with the following code:we will get exception:
We need to find solution to use worker thread in impress. @nechaido you can assign this task to developers.
The text was updated successfully, but these errors were encountered: