-
|
I am writing a chat bot and trying to use bevy_ecs with it. I want to access the World in these threads to be able to manipulate the world, how ever when I try to do this, I get an error: I have the World wrapped in a Mutex: Full src: https://github.com/bit-shift-io/text-rpg/blob/main/src/globals.rs Inside my thread function: Full src: https://github.com/bit-shift-io/text-rpg/blob/main/src/commands/start_a_new_game.rs I haven't done much with rust multi threading so not sure what options I have to resolve this problem. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
As the error message mentions, your problem is with the |
Beta Was this translation helpful? Give feedback.
-
|
That works, thanks! |
Beta Was this translation helpful? Give feedback.
As the error message mentions, your problem is with the
MutexGuardreturned bylocknot beingSend, rather thanWorld. You should be able to solve this by wrapping those two lines in a block, so that theMutexGuardis not in scope when the next.awaitis called.