#How to handle async rwlock in bevy systems?

2 messages · Page 1 of 1 (latest)

lost rune
#

I'm using bevy and tokio, and I have the bevy App running in a tokio task. I have a resource that I would like to share with both a bevy App and some additional code outside of bevy. The resource's struct declares some fields with Arc<RwLock<T>> types that use tokio's async RwLocks.

Is it possible to await the async RwLocks within a bevy system in order to use this resource? If not, then is the only solution to use blocking RwLocks and to run my external code on a tokio::spawn_blocking task?

inner osprey