-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Conversation
CI failure looks related: can you investigate? |
crates/bevy_tasks/src/task_pool.rs
Outdated
@@ -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>, |
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.
No need for fully qualified path
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.
CI keeps hanging. IMO we should just close this rather than trying to debug further: the gains here are not significant.
crates/bevy_tasks/src/task_pool.rs
Outdated
@@ -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()); |
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.
might be worth trying usize::MAX here and seeing if it helps.
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.
I already tried this above and it doesn't seem to work.
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. |
Welp tried again, nope still not working as expected. |
Objective
We don't actually need the full functionality of
async_channel
forbevy_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.