Skip to content

n-api: Re-use napi_env between modules

Create a std::map keyed on the isolate pointer and storing one napi_env per isolate and protect it with a mutex.

Re: https://github.com/nodejs/node/pull/13872#discussion_r126908717

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

n-api

@bnoordhuis @mhdawson this is what sharing the napi_env would look like with a global static and a mutex.

Merge request reports

Loading