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.
Continuing #33 (thread-safety).
This pull request will improve 1st-
handleResume()
(call ofinitResumeClosure
) by not switching around internal states to force-callconfigure.resume()
when task's initial state is.Paused
.(switching around can be dangerous when transitions e.g.
handleProgress()
occurs in other threads)Also, force-calling
configure.resume()
afterinitResumeClosure()
will be annoying especially in ReactKit when it wants to 1st-resume upstream in other threads (e.g.startAsync
orRx.subscribeOn
), whereasconfigure.resume()
will 1st-resume in current thread, so its timing will be indeterminate.Thus, from ver 3.2.0,
configure.resume()
will be called from 2nd time ofresume()
,considering 1st time as start of the task.
This change will not modify current API, but behavior may change slightly.
NOTE If you are using SwiftTask as standalone, this fix will not affect in most cases because its initial state is set as
.Running
by default.