godot-rust / gdext

Rust bindings for Godot 4
https://mastodon.gamedev.place/@GodotRust
Mozilla Public License 2.0
2.74k stars 166 forks source link

Async/Await #640

Open OptimusLime opened 4 months ago

OptimusLime commented 4 months ago

As I understand it, the base Godot C++ GDExtension library doesn't handle async/yield. I recognize that gdext doesn't have the functionality either, even though gdnative version of godot-rust was able to do it.

  1. Is it even possible to get an await call to work?
  2. What would be the simplest way to enable this, even if it's not ideal?

Any hints for how to do this in gdext would be amazing, thank you!

coder137 commented 4 months ago

@OptimusLime Maybe this thread can help? https://discord.com/channels/723850269347283004/1213264585725837364/1213264585725837364

Basically smol::LocalExecutor and its try_tick function should work here

Bromeon commented 4 months ago

There are a few people on Discord who have experimented with async, and there's also prior art in the gdnative project with its gdnative::task module.

But for me personally, async support is not a priority in the library, there are many other things I'd like to do first. For example, coming up with a better threading model might also help for some questions in async. So, unless someone is willing to spend the time on this, don't expect there to be much progress this year 🙂