This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jfirebaugh
force-pushed
the
cleanup-file-source
branch
4 times, most recently
from
November 14, 2015 02:44
958ce9c
to
1f67471
Compare
// because if the request was cancelled, then R might have been destroyed. L2 needs to check | ||
// the flag because the request may have been cancelled after L2 was invoked but before it | ||
// began executing. | ||
auto after = [flag, current = RunLoop::current.get(), callback1 = std::move(callback)] (auto&&... results1) { |
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.
Good catch.
Kudos @jfirebaugh, I really liked this. |
Aside from the following minor naming issue this is working great for me, and fixes the segfaults I was seeing previously in #2334.
@miccolis Is removing the JavaScript |
@mikemorris removing |
jfirebaugh
force-pushed
the
cleanup-file-source
branch
5 times, most recently
from
November 16, 2015 20:23
6d92558
to
6fb713d
Compare
…hCallback The doubly nested lambda that's responsible for executing the callback needs to check the cancellation flag on *both* threads. See comment for details.
This should be abstracted by util::RunLoop
jfirebaugh
force-pushed
the
cleanup-file-source
branch
from
November 16, 2015 20:25
6fb713d
to
43c6e2f
Compare
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
👀 @tmpsantos @kkaefer @mikemorris
Clean up FileSource by taking advantage of the safe callback and cancellation semantics provided by
RunLoop::invokeWithCallback
.Fixes #2827, eliminates the complex logic around
Resource
destruction, eliminatesResourceHolder
, moves us toward #2909.Also allows simplification of the node implementation of
FileSource
: we can useRunLoop
to handle dispatch back to the node event loop. I removed JS-level cancellation via the optional "cancel" property; it was untested and unused. (Note thatRunLoop::invokeWithCallback
handles cancellation at the C++ level; i.e. not calling the callback if the request has already been cancelled.)