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

Detached non-Send tasks don't run #6120

Closed
Suficio opened this issue Sep 28, 2022 · 0 comments
Closed

Detached non-Send tasks don't run #6120

Suficio opened this issue Sep 28, 2022 · 0 comments
Labels
A-Tasks Tools for parallel and async work C-Bug An unexpected or incorrect behavior
Milestone

Comments

@Suficio
Copy link
Contributor

Suficio commented Sep 28, 2022

Detached task on local thread is not run after:
#4466

Bevy version

First commit to be affected:
d22d310

Relevant system information

  • cargo 1.64.0 (387270bc7 2022-09-16)
  • Windows 11

What you did

use bevy::{prelude::*, tasks::ComputeTaskPool};

fn main() {
    App::new()
        .add_plugins(MinimalPlugins)
        .add_startup_system(startup)
        .run();
}

fn startup() {
    ComputeTaskPool::get()
        .spawn_local(async { println!("hi") })
        .detach();
}

What went wrong

hi is not printed :(

@Suficio Suficio added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Sep 28, 2022
@alice-i-cecile alice-i-cecile added A-Tasks Tools for parallel and async work and removed S-Needs-Triage This issue needs to be labelled labels Sep 28, 2022
@alice-i-cecile alice-i-cecile added this to the Bevy 0.9 milestone Sep 28, 2022
@bors bors bot closed this as completed in 0f3f628 Oct 24, 2022
james7132 pushed a commit to james7132/bevy that referenced this issue Oct 28, 2022
# Objective

- bevyengine#4466 broke local tasks running.
- Fixes bevyengine#6120

## Solution

- Add system for ticking local executors on main thread into bevy_core where the tasks pools are initialized.
- Add ticking local executors into thread executors

## Changelog

- tick all thread local executors in task pool.

## Notes

- ~~Not 100% sure about this PR. Ticking the local executor for the main thread in scope feels a little kludgy as it requires users of bevy_tasks to be calling scope periodically for those tasks to make progress.~~ took this out in favor of a system that ticks the local executors.
Pietrek14 pushed a commit to Pietrek14/bevy that referenced this issue Dec 17, 2022
# Objective

- bevyengine#4466 broke local tasks running.
- Fixes bevyengine#6120

## Solution

- Add system for ticking local executors on main thread into bevy_core where the tasks pools are initialized.
- Add ticking local executors into thread executors

## Changelog

- tick all thread local executors in task pool.

## Notes

- ~~Not 100% sure about this PR. Ticking the local executor for the main thread in scope feels a little kludgy as it requires users of bevy_tasks to be calling scope periodically for those tasks to make progress.~~ took this out in favor of a system that ticks the local executors.
ItsDoot pushed a commit to ItsDoot/bevy that referenced this issue Feb 1, 2023
# Objective

- bevyengine#4466 broke local tasks running.
- Fixes bevyengine#6120

## Solution

- Add system for ticking local executors on main thread into bevy_core where the tasks pools are initialized.
- Add ticking local executors into thread executors

## Changelog

- tick all thread local executors in task pool.

## Notes

- ~~Not 100% sure about this PR. Ticking the local executor for the main thread in scope feels a little kludgy as it requires users of bevy_tasks to be calling scope periodically for those tasks to make progress.~~ took this out in favor of a system that ticks the local executors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Tasks Tools for parallel and async work C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants