You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+40Lines changed: 40 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -88,6 +88,46 @@ Make sure to use `call_async_function` for async python functions. Using `call_f
88
88
probably raise an error.
89
89
`call_async_function` is not available for RustPython.
90
90
91
+
### Thread Safety
92
+
93
+
The `PyRunner` is designed to be safely shared across multiple threads.
94
+
95
+
You can clone a `PyRunner` instance and move it into different threads. All commands sent from any clone are funneled through a channel to a single, dedicated OS thread that houses the Python interpreter. This design correctly handles Python's Global Interpreter Lock (GIL) by ensuring that only one Python operation is attempted at any given time within that interpreter instance.
96
+
97
+
Here is an example of using `PyRunner` from multiple `std::thread`s:
0 commit comments