BlackPhlox / bevy_midi

Send and receive MIDI data to and from bevy using DAWS or MIDI Controllers
Apache License 2.0
56 stars 10 forks source link

use non blocking futures instead of async methods #27

Closed mockersf closed 12 months ago

mockersf commented 1 year ago

Fixes #24, alternative to #25

Instead of spawning tasks that are just thinly async function that always block, create futures that don't block

To reproduce the issue, you can set the number of thread in the IO task pool by doing

        .add_plugins(
            DefaultPlugins
                .set(TaskPoolPlugin {
                    task_pool_options: TaskPoolOptions {
                        io: TaskPoolThreadAssignmentPolicy {
                            min_threads: 1,
                            max_threads: 1,
                            percent: 1.0,
                        },
                        ..default()
                    },
                }),
        )

and settings logs for bevy_core to trace to confirm. Running example piano with those settings blocks and don't render anything on main, but works with this PR

BlackPhlox commented 12 months ago

Thanks, this is great! I could reproduce the issue 🚀 Merging this in lieu of #25