Skip to content

Conversation

@gabrielschulhof
Copy link
Contributor

The pointer used to hold an incoming dynamically loaded module's
node::node_module structure needs to be thread-local. So far this was
done with uv_key_set() and uv_key_get(). The language now supports
the thread_local keyword which makes implementing this a lot cleaner.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Jun 27, 2019
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just node_module*, no struct (see lines above), and the = nullptr isn't strictly necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 on the node_module*, but I'd like to keep the initialization because we do a

CHECK_NULL(thread_local_modpending);

later on, and I'm not 100% sure that these variables get initialized on every platform.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, looks like the variable oughta get zeroed out: https://en.cppreference.com/w/cpp/language/initialization#Static_initialization

@gabrielschulhof gabrielschulhof force-pushed the thread-local-modpending branch from b2ad535 to 72fb292 Compare June 28, 2019 20:31
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

The pointer used to hold an incoming dynamically loaded module's
`node::node_module` structure needs to be thread-local. So far this was
done with `uv_key_set()` and `uv_key_get()`. The language now supports
the `thread_local` keyword which makes implementing this a lot cleaner.
@gabrielschulhof gabrielschulhof force-pushed the thread-local-modpending branch from 72fb292 to e7b6417 Compare July 2, 2019 21:08
@gabrielschulhof
Copy link
Contributor Author

Let's see if rebasing makes a difference for the CI.

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Jul 2, 2019

CI: https://ci.nodejs.org/job/node-test-pull-request/24227/
node-test-commit-windows-fanned and node-test-binary-windows-2 were yellow.

@gabrielschulhof
Copy link
Contributor Author

Landed in d3b10f6.

gabrielschulhof pushed a commit to gabrielschulhof/node that referenced this pull request Jul 2, 2019
The pointer used to hold an incoming dynamically loaded module's
`node::node_module` structure needs to be thread-local. So far this was
done with `uv_key_set()` and `uv_key_get()`. The language now supports
the `thread_local` keyword which makes implementing this a lot cleaner.

PR-URL: nodejs#28456
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
@gabrielschulhof gabrielschulhof deleted the thread-local-modpending branch July 2, 2019 23:16
targos pushed a commit that referenced this pull request Jul 20, 2019
The pointer used to hold an incoming dynamically loaded module's
`node::node_module` structure needs to be thread-local. So far this was
done with `uv_key_set()` and `uv_key_get()`. The language now supports
the `thread_local` keyword which makes implementing this a lot cleaner.

PR-URL: #28456
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This was referenced Jul 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants