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

Replace async_channel with event_listener in bevy_tasks #11942

Closed
wants to merge 7 commits into from

Conversation

james7132
Copy link
Member

Objective

We don't actually need the full functionality of async_channel for bevy_tasks, which is only used for shutdown of the TaskPool on drop.

Solution

Replace it with event_listener, which is already in the bevy_tasks dependency subtree.

This likely won't save us much, since we do need async_channel for bevy_ecs, but it should keep the dependency tree a bit cleaner here.

@james7132 james7132 requested a review from hymm February 18, 2024 09:15
@james7132 james7132 added the A-Tasks Tools for parallel and async work label Feb 18, 2024
@rparrett rparrett added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Feb 19, 2024
@alice-i-cecile
Copy link
Member

CI failure looks related: can you investigate?

@james7132 james7132 added the C-Dependencies A change to the crates that Bevy depends on label Feb 21, 2024
@@ -115,7 +116,7 @@ pub struct TaskPool {

/// Inner state of the pool
threads: Vec<JoinHandle<()>>,
shutdown_tx: async_channel::Sender<()>,
shutdown: Arc<event_listener::Event>,
Copy link
Contributor

Choose a reason for hiding this comment

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

No need for fully qualified path

Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

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

CI keeps hanging. IMO we should just close this rather than trying to debug further: the gains here are not significant.

@alice-i-cecile alice-i-cecile removed the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Feb 26, 2024
@@ -584,7 +582,7 @@ impl Default for TaskPool {

impl Drop for TaskPool {
fn drop(&mut self) {
self.shutdown_tx.close();
self.shutdown.notify(self.threads.len());
Copy link
Contributor

Choose a reason for hiding this comment

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

might be worth trying usize::MAX here and seeing if it helps.

Copy link
Member Author

Choose a reason for hiding this comment

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

I already tried this above and it doesn't seem to work.

@james7132
Copy link
Member Author

I think my mental model of how event_listener works might not be sufficient .Closing this out for now. Might not need it if #11995 gets merged.

@james7132 james7132 closed this Feb 27, 2024
@james7132 james7132 reopened this Mar 12, 2024
@james7132
Copy link
Member Author

Welp tried again, nope still not working as expected.

@james7132 james7132 closed this Mar 12, 2024
@james7132 james7132 reopened this Apr 24, 2024
@james7132 james7132 closed this Apr 24, 2024
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-Dependencies A change to the crates that Bevy depends on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants