Communication between Python and Rust threads/asyncloops #3438
-
Hey folks 👋 I'm a new guy to the PyO3 and its community, but I have gotten an interesting case to implement and wanted to consult with you on where to start. I want to implement a class in Rust that would either run in a separate thread or thread + event loop. When started, the class is going to do some work (until explicitly stopped) and will put the results somewhere (normally, it would be some sort of queue). At the same time, Python will be running in its own thread and will be pulling those results and processing them further. So both parties (Python & Rust) will be running at their own paces and would be sharing just some sort of queue. What is the best way to archive this sort of evilibrium? I would appreciate any information, examples that would seed my further investigation. Thank you in advance 🙏 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
Sorry for the delayed reply. Are you using If you want to send Python and Rust jobs between threads, maybe #576 (comment) will be interesting to you. |
Beta Was this translation helpful? Give feedback.
Sorry for the delayed reply. Are you using
async
? If so,pyo3-asyncio
may be able to help solve your problems and provide examples.If you want to send Python and Rust jobs between threads, maybe #576 (comment) will be interesting to you.