-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
src: RegisterHandleCleanups reduce duplication #33421
Conversation
This commit suggest using a lambda for the RegisterHandlerCleanup calls in RegisterHandleCleanups. The motivation is to reduce some duplication and to make it a little easier to read as all of the calls pass in the same arguments, apart from casting the uv handle.
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.
How about using #define
macro? I worry about the performance reduce of lambda
#define V(hook) \
RegisterHandleCleanup( \
reinterpret_cast<uv_handle_t*>(hook), close_and_finish, nullptr)
V(timer_handle());
V(immediate_check_handle());
V(immediate_idle_handle());
V(&idle_prepare_handle_);
V(&idle_check_handle_);
V(&task_queues_async_);
#undef V
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 and please, no macro :)
@himself65 This code is only run once per |
Landed in 61189d3 |
This commit suggest using a lambda for the RegisterHandlerCleanup calls in RegisterHandleCleanups. The motivation is to reduce some duplication and to make it a little easier to read as all of the calls pass in the same arguments, apart from casting the uv handle. PR-URL: #33421 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: David Carlier <devnexen@gmail.com>
This commit suggest using a lambda for the RegisterHandlerCleanup calls in RegisterHandleCleanups. The motivation is to reduce some duplication and to make it a little easier to read as all of the calls pass in the same arguments, apart from casting the uv handle. PR-URL: #33421 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: David Carlier <devnexen@gmail.com>
This commit suggest using a lambda for the RegisterHandlerCleanup calls in RegisterHandleCleanups. The motivation is to reduce some duplication and to make it a little easier to read as all of the calls pass in the same arguments, apart from casting the uv handle. PR-URL: #33421 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: David Carlier <devnexen@gmail.com>
This commit suggest using a lambda for the RegisterHandlerCleanup calls in RegisterHandleCleanups. The motivation is to reduce some duplication and to make it a little easier to read as all of the calls pass in the same arguments, apart from casting the uv handle. PR-URL: #33421 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: David Carlier <devnexen@gmail.com>
This commit suggest using a lambda for the RegisterHandlerCleanup calls
in RegisterHandleCleanups.
The motivation is to reduce some duplication and to make it a little
easier to read as all of the calls pass in the same arguments, apart
from casting the uv handle.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes