I was gonna create a Pyo3 library which implements some RL environments. I had been using Pyo3 for other tasks. I was gonna use also SDL2 rendering, however it gives me an error.
#[pyclass]
pub struct FirstEnv {
pos: f32,
renderer: Renderer,
}
pub struct Renderer {
canvas: sdl2::render::WindowCanvas,
}
The error:
Rc<RendererContext<WindowContext>>
cannot be sent between threads safely
Is there a fix for this ? Or this kind of a combo will not work?
It shows me that within FirstEnv
, the trait Send
is not implemented for Rc<RendererContext<WindowContext>>
. As I am new in rust tried googling and it says that it is not thread safe. However, I am not sure what should I do.