From 41c6521a3897ad2894b5cea7b77dbef1b3631141 Mon Sep 17 00:00:00 2001 From: Mikkel Rasmussen Date: Sat, 11 Nov 2023 15:00:26 +0100 Subject: [PATCH] Reverted back TaskPool changes --- src/input.rs | 20 +++++++++----------- src/output.rs | 15 +-------------- 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/src/input.rs b/src/input.rs index f682990..1795c56 100644 --- a/src/input.rs +++ b/src/input.rs @@ -174,18 +174,16 @@ fn setup(mut commands: Commands, settings: Res) { let (m_sender, m_receiver) = crossbeam_channel::unbounded::(); let (r_sender, r_receiver) = crossbeam_channel::unbounded::(); - //Got issues with the rewrite : https://github.com/bevyengine/bevy/pull/10008 + //Got issues with the taskpool rewrite : https://github.com/bevyengine/bevy/pull/10008 let thread_pool = IoTaskPool::get_or_init(|| TaskPool::new()); - thread_pool.scope(|s|{ - s.spawn(async { - MidiInputTask { - receiver: m_receiver, - sender: r_sender, - settings: settings.clone(), - input: None, - connection: None, - } - }) + thread_pool.spawn({ + MidiInputTask { + receiver: m_receiver, + sender: r_sender, + settings: settings.clone(), + input: None, + connection: None, + } }); commands.insert_resource(MidiInput { diff --git a/src/output.rs b/src/output.rs index 29e54d7..00665de 100644 --- a/src/output.rs +++ b/src/output.rs @@ -136,20 +136,8 @@ fn setup(mut commands: Commands, settings: Res) { let (m_sender, m_receiver) = crossbeam_channel::unbounded(); let (r_sender, r_receiver) = crossbeam_channel::unbounded(); + //Got issues with the taskpool rewrite : https://github.com/bevyengine/bevy/pull/10008 let thread_pool = IoTaskPool::get_or_init(|| TaskPool::new()); - thread_pool.scope(|s|{ - s.spawn(async { - MidiOutputTask { - receiver: m_receiver, - sender: r_sender, - settings: settings.clone(), - output: None, - connection: None, - } - }) - }); - /* - let thread_pool = IoTaskPool::get(); thread_pool .spawn(MidiOutputTask { receiver: m_receiver, @@ -159,7 +147,6 @@ fn setup(mut commands: Commands, settings: Res) { connection: None, }) .detach(); - */ commands.insert_resource(MidiOutput { sender: m_sender,