-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
n-api: clean up thread-safe function #22259
Conversation
src/node_api.cc
Outdated
@@ -827,6 +827,339 @@ napi_status ConcludeDeferred(napi_env env, | |||
return GET_RETURN_STATUS(env); | |||
} | |||
|
|||
class TsFn: public node::AsyncResource { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style nits: I'd very much prefer to spell out ThreadSafeFunction
, and we use spaces before the :
in a class declaration
If you need abbreviations for individual functions, I think an using
line might do the trick
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please avoid abbreviations
src/node_api.cc
Outdated
|
||
node::Environment::GetCurrent(env->isolate)->CloseHandle( | ||
reinterpret_cast<uv_handle_t*>(&async), | ||
[] (uv_handle_t* handle) -> void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style nit: No space after []
Aside, we have make format-cpp
(possibly preceded by make format-cpp-build
), that should take care of style issues now :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM once @addaleax comments are addressed.
d18e135
to
dc67065
Compare
Another CI from the top: https://ci.nodejs.org/job/node-test-pull-request/16731/ |
* Move class `TsFn` to name space `v8impl` and rename it to `ThreadSafeFunction` * Remove `NAPI_EXTERN` from API declarations, because it's only needed in the header file.
dc67065
to
2790896
Compare
Wow! |
Resumed as CI: https://ci.nodejs.org/job/node-test-pull-request/16915/ ✓ |
Landed in 403df7c. |
* Move class `TsFn` to name space `v8impl` and rename it to `ThreadSafeFunction` * Remove `NAPI_EXTERN` from API declarations, because it's only needed in the header file. PR-URL: nodejs#22259 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Kyle Farnung <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
* Move class `TsFn` to name space `v8impl` and rename it to `ThreadSafeFunction` * Remove `NAPI_EXTERN` from API declarations, because it's only needed in the header file. PR-URL: #22259 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Kyle Farnung <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
* Move class `TsFn` to name space `v8impl` and rename it to `ThreadSafeFunction` * Remove `NAPI_EXTERN` from API declarations, because it's only needed in the header file. PR-URL: #22259 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Kyle Farnung <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
* Move class `TsFn` to name space `v8impl` and rename it to `ThreadSafeFunction` * Remove `NAPI_EXTERN` from API declarations, because it's only needed in the header file. PR-URL: #22259 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Kyle Farnung <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
* Move class `TsFn` to name space `v8impl` and rename it to `ThreadSafeFunction` * Remove `NAPI_EXTERN` from API declarations, because it's only needed in the header file. PR-URL: nodejs#22259 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Kyle Farnung <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
* Move class `TsFn` to name space `v8impl` and rename it to `ThreadSafeFunction` * Remove `NAPI_EXTERN` from API declarations, because it's only needed in the header file. Backport-PR-URL: #25002 PR-URL: #22259 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Kyle Farnung <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
* Move class `TsFn` to name space `v8impl` and rename it to `ThreadSafeFunction` * Remove `NAPI_EXTERN` from API declarations, because it's only needed in the header file. Backport-PR-URL: #25002 PR-URL: #22259 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Kyle Farnung <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
TsFn
to name spacev8impl
NAPI_EXTERN
from API declarations, because it's only neededin the header file.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes