Skip to content
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

[Tasks] Mark parent as sticky if we use @async #41334

Merged
merged 2 commits into from
Jun 30, 2021
Merged

[Tasks] Mark parent as sticky if we use @async #41334

merged 2 commits into from
Jun 30, 2021

Conversation

vchuravy
Copy link
Member

@vchuravy vchuravy commented Jun 23, 2021

Fixes #41324 for 1.7

@vchuravy vchuravy added this to the 1.7 milestone Jun 23, 2021
@vchuravy vchuravy added backport 1.7 multithreading Base.Threads and related functionality labels Jun 23, 2021
@vchuravy vchuravy requested a review from vtjnash June 23, 2021 15:25
parent = Threads.@spawn begin
@test current_task().sticky == false
child = @async begin end
@test current_task().sticky == true
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Seems like it would be better to compare threadid() to check that they're the same.

@tkf
Copy link
Member

tkf commented Jun 28, 2021

FYI I wrote #41393 which adds a bit more code but can unstick the parent

Co-authored-by: Valentin Churavy <[email protected]>
@JeffBezanson JeffBezanson merged commit 75858d7 into master Jun 30, 2021
@JeffBezanson JeffBezanson deleted the vc/sticky branch June 30, 2021 02:43
KristofferC pushed a commit that referenced this pull request Jun 30, 2021
Fixes #41324 for 1.7

(cherry picked from commit 75858d7)
johanmon pushed a commit to johanmon/julia that referenced this pull request Jul 5, 2021
vtjnash added a commit that referenced this pull request Oct 21, 2021
The `_wait2` function is similar to calling `schedule + wait` from
another `@async` task, but optimized, so we want to observe the same
side-effects of making the task sticky to the correct thread (and not
accidentally making it sticky to the later task that handles the event).

Refs #41334 (75858d7)
DilumAluthge pushed a commit that referenced this pull request Oct 22, 2021
The `_wait2` function is similar to calling `schedule + wait` from
another `@async` task, but optimized, so we want to observe the same
side-effects of making the task sticky to the correct thread (and not
accidentally making it sticky to the later task that handles the event).

Refs #41334 (75858d7)

Co-authored-by: Takafumi Arakaki <[email protected]>
KristofferC pushed a commit that referenced this pull request Oct 22, 2021
The `_wait2` function is similar to calling `schedule + wait` from
another `@async` task, but optimized, so we want to observe the same
side-effects of making the task sticky to the correct thread (and not
accidentally making it sticky to the later task that handles the event).

Refs #41334 (75858d7)

Co-authored-by: Takafumi Arakaki <[email protected]>
(cherry picked from commit 6420885)
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Feb 22, 2022
The `_wait2` function is similar to calling `schedule + wait` from
another `@async` task, but optimized, so we want to observe the same
side-effects of making the task sticky to the correct thread (and not
accidentally making it sticky to the later task that handles the event).

Refs JuliaLang#41334 (75858d7)

Co-authored-by: Takafumi Arakaki <[email protected]>
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Mar 8, 2022
The `_wait2` function is similar to calling `schedule + wait` from
another `@async` task, but optimized, so we want to observe the same
side-effects of making the task sticky to the correct thread (and not
accidentally making it sticky to the later task that handles the event).

Refs JuliaLang#41334 (75858d7)

Co-authored-by: Takafumi Arakaki <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
multithreading Base.Threads and related functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@async tasks executes simultaneously with parent task if launched with @spawn
5 participants