Skip to content

Conversation

@fhinkel
Copy link
Member

Use std::unique_ptr for delayed tasks in the scheduled
delayed tasks vector. This makes it clear that the vector
has ownership of the delayed tasks and is responsible for
deleting them.

Use a custom deleter for the pointers because libuv
needs to close the handle and then delete the data. Provide
the handle when creating the pointer instead of invoking the
special delete action everytime an element is removed from the vector.

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

src

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

Choose a reason for hiding this comment

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

Does the linter complain if you align arguments vertically?

Copy link
Member

Choose a reason for hiding this comment

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

Can you call this DelayedTaskPointer or something like that? Just to make clear it’s still a pointer and it’s not a conceptually different kind of thing

Use std::unique_ptr for delayed tasks in the scheduled delayed tasks vector. This makes it clear that the vector has ownership of the delayed tasks and is responsible for deleting them. Use a custom deleter for the pointers because libuv needs to close the handle and then delete the data. Provide the handle when creating the pointer instead of invoking the special delete action everytime an element is removed from the vector.
@fhinkelfhinkelforce-pushed the nov/refactor_delete_from_scheduled_tasks branch from a7cc724 to 8fe4791CompareNovember 16, 2017 21:41
@fhinkel
Copy link
MemberAuthor

Landed in 24e824a.

@fhinkelfhinkel closed this Nov 19, 2017
fhinkel added a commit that referenced this pull request Nov 19, 2017
Use std::unique_ptr for delayed tasks in the scheduled delayed tasks vector. This makes it clear that the vector has ownership of the delayed tasks and is responsible for deleting them. Use a custom deleter for the pointers because libuv needs to close the handle and then delete the data. Provide the handle when creating the pointer instead of invoking the special delete action everytime an element is removed from the vector. PR-URL: #17083 Reviewed-By: Anna Henningsen <[email protected]>
@addaleax
Copy link
Member

@fhinkel Looks like this is the commit that is actually breaking CI :(

addaleax added a commit to addaleax/node that referenced this pull request Nov 19, 2017
addaleax added a commit that referenced this pull request Nov 19, 2017
MylesBorins pushed a commit that referenced this pull request Dec 12, 2017
Use std::unique_ptr for delayed tasks in the scheduled delayed tasks vector. This makes it clear that the vector has ownership of the delayed tasks and is responsible for deleting them. Use a custom deleter for the pointers because libuv needs to close the handle and then delete the data. Provide the handle when creating the pointer instead of invoking the special delete action everytime an element is removed from the vector. PR-URL: #17083 Reviewed-By: Anna Henningsen <[email protected]>
MylesBorins pushed a commit that referenced this pull request Dec 12, 2017
@MylesBorinsMylesBorins mentioned this pull request Dec 12, 2017
@gibfahn
Copy link
Member

gibfahn commented Dec 19, 2017

@fhinkel would you mind raising a backport for this and #17133 on v8.x?

@MylesBorins
Copy link
Contributor

The files changed in this PR do not exist on v6.x

Please feel free to change label if it can be manually backported

@MylesBorins
Copy link
Contributor

ping @fhinkel re: backport

addaleax pushed a commit to addaleax/node that referenced this pull request May 22, 2018
Use std::unique_ptr for delayed tasks in the scheduled delayed tasks vector. This makes it clear that the vector has ownership of the delayed tasks and is responsible for deleting them. Use a custom deleter for the pointers because libuv needs to close the handle and then delete the data. Provide the handle when creating the pointer instead of invoking the special delete action everytime an element is removed from the vector. PR-URL: nodejs#17083 Reviewed-By: Anna Henningsen <[email protected]>
@addaleax
Copy link
Member

Included a backport in #20901

MylesBorins pushed a commit that referenced this pull request Jun 14, 2018
Use std::unique_ptr for delayed tasks in the scheduled delayed tasks vector. This makes it clear that the vector has ownership of the delayed tasks and is responsible for deleting them. Use a custom deleter for the pointers because libuv needs to close the handle and then delete the data. Provide the handle when creating the pointer instead of invoking the special delete action everytime an element is removed from the vector. Backport-PR-URL: #20901 PR-URL: #17083 Reviewed-By: Anna Henningsen <[email protected]>
@MylesBorinsMylesBorins mentioned this pull request Jul 9, 2018
rvagg pushed a commit that referenced this pull request Aug 16, 2018
Use std::unique_ptr for delayed tasks in the scheduled delayed tasks vector. This makes it clear that the vector has ownership of the delayed tasks and is responsible for deleting them. Use a custom deleter for the pointers because libuv needs to close the handle and then delete the data. Provide the handle when creating the pointer instead of invoking the special delete action everytime an element is removed from the vector. Backport-PR-URL: #20901 PR-URL: #17083 Reviewed-By: Anna Henningsen <[email protected]>
@addaleaxaddaleax added the v8 platform Issues and PRs related to Node's v8::Platform implementation. label Feb 18, 2020
Sign up for freeto 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++.v8 platformIssues and PRs related to Node's v8::Platform implementation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@fhinkel@addaleax@gibfahn@MylesBorins@nodejs-github-bot