Closed vdeturckheim closed 8 months ago
Potentially solves #82
This PR fixes the problems related with worker_threads and the waf. Added a test to check that it is working fine. This PR also break the compatibility with node12, so next release should be a major release.
Here is a very short explanation about why this solves the problem: https://github.com/nodejs/node-addon-api/issues/711
Explanation: this example set the constructor static member of the class to a reference of the constructor function but if the addon is loaded multiple time (with worker_threads for example), the value is overwritten by a new reference in the new context. That makes this reference unusable to create new instances of this wrapped class from other C++ code and makes any code wanting to use this reference in another context crash.
🚀 🚀 🚀
@simon-id , please add some tests when you have a way to reproduce the issue